Fixed Issue 702: Ability to recognize stroke weight of group

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1892 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-12-21 14:34:54 +00:00
parent 2c7f131050
commit 5193e8732d
1 changed files with 21 additions and 25 deletions

View File

@ -1340,8 +1340,6 @@
var updateToolbar = function() {
if (selectedElement != null) {
var all_swidth = null;
switch ( selectedElement.tagName ) {
case 'use':
case 'image':
@ -1351,21 +1349,21 @@
case 'a':
// Look for common styles
// var gFill = null;
//
// var childs = selectedElement.getElementsByTagName('*');
// for(var i = 0, len = childs.length; i < len; i++) {
// var swidth = elem.getAttribute("stroke-width");
// if(swidth && swidth !== all_swidth) {
// // different, so do don't check more
// all_swidth = null;
// break;
// } else if(swidth) {
// console.log('e', elem, swidth);
// all_swidth = swidth;
// }
// }
//
var gWidth = null;
var childs = selectedElement.getElementsByTagName('*');
for(var i = 0, len = childs.length; i < len; i++) {
var swidth = childs[i].getAttribute("stroke-width");
if(i === 0) {
gWidth = swidth;
} else if(gWidth !== swidth) {
gWidth = null;
}
}
$('#stroke_width').val(gWidth === null ? "" : gWidth);
paintBox.fill.update(true);
paintBox.stroke.update(true);
@ -1375,7 +1373,7 @@
paintBox.fill.update(true);
paintBox.stroke.update(true);
$('#stroke_width').val(all_swidth || selectedElement.getAttribute("stroke-width") || 1);
$('#stroke_width').val(selectedElement.getAttribute("stroke-width") || 1);
$('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none");
var attr = selectedElement.getAttribute("stroke-linejoin") || 'miter';
@ -1917,17 +1915,13 @@
paintBox[picker].setPaint(paint);
if (isStroke) {
if (svgCanvas.getColor('stroke') != color) {
svgCanvas.setColor('stroke', color);
}
if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) {
svgCanvas.setPaintOpacity('stroke', 1.0);
}
} else {
if (svgCanvas.getColor('fill') != color) {
svgCanvas.setColor('fill', color);
}
if (color != 'none' && svgCanvas.getFillOpacity('fill') != 1) {
if (color != 'none' && svgCanvas.getFillOpacity() != 1) {
svgCanvas.setPaintOpacity('fill', 1.0);
}
}
@ -3396,10 +3390,12 @@
gPaint = p;
} else if(gPaint !== p) {
gPaint = null;
break;
}
}
if(gPaint === null) {
// No common color, don't update anything
var paintColor = null;
return;
}
var paintColor = gPaint;