added getPaintOpacity() on svgCanvas, used it to simplify mouseDown callback on palette in svgEditor
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2430 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
bccb227cdd
commit
12f5fd9bce
|
@ -1911,11 +1911,10 @@
|
|||
});
|
||||
|
||||
$('.palette_item').mousedown(function(evt) {
|
||||
var right_click = evt.button === 2;
|
||||
var isStroke = evt.shiftKey || right_click;
|
||||
var picker = isStroke ? 'stroke' : 'fill';
|
||||
var color = $(this).attr('data-rgb');
|
||||
var paint = null;
|
||||
// shift key or right click for stroke
|
||||
var picker = evt.shiftKey || evt.button === 2 ? 'stroke' : 'fill';
|
||||
var color = $(this).data('rgb');
|
||||
var paint;
|
||||
|
||||
// Webkit-based browsers returned 'initial' here for no stroke
|
||||
if (color === 'none' || color === 'transparent' || color === 'initial') {
|
||||
|
@ -1926,17 +1925,10 @@
|
|||
}
|
||||
|
||||
paintBox[picker].setPaint(paint);
|
||||
svgCanvas.setColor(picker, color);
|
||||
|
||||
if (isStroke) {
|
||||
svgCanvas.setColor('stroke', color);
|
||||
if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('stroke', 1.0);
|
||||
}
|
||||
} else {
|
||||
svgCanvas.setColor('fill', color);
|
||||
if (color != 'none' && svgCanvas.getFillOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('fill', 1.0);
|
||||
}
|
||||
if (color !== 'none' && svgCanvas.getPaintOpacity(picker) !== 1) {
|
||||
svgCanvas.setPaintOpacity(picker, 1.0);
|
||||
}
|
||||
updateToolButtonState();
|
||||
}).bind('contextmenu', function(e) {e.preventDefault();});
|
||||
|
|
|
@ -6860,6 +6860,15 @@ this.setPaintOpacity = function(type, val, preventUndo) {
|
|||
changeSelectedAttributeNoUndo(type + "-opacity", val);
|
||||
};
|
||||
|
||||
// Function: getPaintOpacity
|
||||
// Gets the current fill/stroke opacity
|
||||
//
|
||||
// Parameters:
|
||||
// type - String with "fill" or "stroke"
|
||||
this.getPaintOpacity = function(type) {
|
||||
return type === 'fill' ? this.getFillOpacity() : this.getStrokeOpacity();
|
||||
};
|
||||
|
||||
// Function: getBlur
|
||||
// Gets the stdDeviation blur value of the given element
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue