add getters

fix transparent handling in picker


git-svn-id: http://svg-edit.googlecode.com/svn/trunk@38 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Pavol Rusnak 2009-06-06 12:25:26 +00:00
parent 979949da7a
commit 4aedad493b
2 changed files with 41 additions and 0 deletions

View File

@ -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();
});
}

View File

@ -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;
}