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