From 4aedad493bd61f39d4b2ec2e46cbb6d05c19afcc Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 6 Jun 2009 12:25:26 +0000 Subject: [PATCH] add getters fix transparent handling in picker git-svn-id: http://svg-edit.googlecode.com/svn/trunk@38 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 9 +++++++++ editor/svgcanvas.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index b2a54afd..a5c2e9b4 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -130,8 +130,10 @@ $(document).ready(function(){ $('.tools_flyout').hide(); var oldbg = elem.css('background'); var color = elem.css('background-color'); + var was_none = false; if (color == 'transparent') { color = new $.jPicker.Color({ hex: 'ffffff' }); + was_none = true; } else { if (color.length == 7 && color[0] == '#') { // #hheexx notation color = new $.jPicker.Color( { hex: color.substring(1,7) } ); @@ -158,6 +160,13 @@ $(document).ready(function(){ } , null, function(){ elem.css('background', oldbg); + if (was_none) { + if (elem.attr('id') == 'stroke_color') { + SvgCanvas.setStrokeColor('none'); + } else if (elem.attr('id') == 'fill_color') { + SvgCanvas.setFillColor('none'); + } + } $('#color_picker').hide(); }); } diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index c0ebd9e1..40d7d6f3 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -465,34 +465,66 @@ function SvgCanvas(doc) } } + this.getMode = function() { + return current_mode; + } + this.setMode = function(name) { current_mode = name; } + this.getStrokeColor = function() { + return current_stroke; + } + this.setStrokeColor = function(color) { current_stroke = color; } + this.getFillColor = function() { + return current_fill; + } + this.setFillColor = function(color) { current_fill = color; } + this.getStrokeWidth = function() { + return current_stroke_width; + } + this.setStrokeWidth = function(val) { current_stroke_width = val; } + this.getStrokeStyle = function() { + return current_stroke_style; + } + this.setStrokeStyle = function(val) { current_stroke_style = val; } + this.getOpacity = function() { + return current_opacity; + } + this.setOpacity = function(val) { current_opacity = val; } + this.getFillOpacity = function() { + return current_fill_opacity; + } + this.setFillOpacity = function(val) { current_fill_opacity = val; } + this.getStrokeOpacity = function() { + return current_stroke_opacity; + } + this.setStrokeOpacity = function(val) { current_stroke_opacity = val; }