Fixed Issue 760: Drawing with an imported Image selected sets default stroke and fill to none

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2028 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2011-03-09 20:00:49 +00:00
parent 3f54e9d5e2
commit 1c38606a34
2 changed files with 27 additions and 12 deletions

View File

@ -3480,7 +3480,15 @@
if(!selectedElement) return;
var type = this.type;
if(selectedElement.tagName === 'g') {
switch ( selectedElement.tagName ) {
case 'use':
case 'image':
case 'foreignObject':
// These elements don't have fill or stroke, so don't change
// the current value
return;
case 'g':
case 'a':
var gPaint = null;
var childs = selectedElement.getElementsByTagName('*');
@ -3502,8 +3510,8 @@
var paintColor = gPaint;
var paintOpacity = 1;
} else {
break;
default:
var paintOpacity = parseFloat(selectedElement.getAttribute(type + "-opacity"));
if (isNaN(paintOpacity)) {
paintOpacity = 1.0;

View File

@ -3130,16 +3130,23 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
if (selectedElements[1] == null) {
// set our current stroke/fill properties to the element's
var selected = selectedElements[0];
if (selected.tagName != "g" && selected.tagName != "image" && selected.tagName != "foreignObject") {
cur_properties.fill = selected.getAttribute("fill");
cur_properties.fill_opacity = selected.getAttribute("fill-opacity");
cur_properties.stroke = selected.getAttribute("stroke");
cur_properties.stroke_opacity = selected.getAttribute("stroke-opacity");
cur_properties.stroke_width = selected.getAttribute("stroke-width");
cur_properties.stroke_dasharray = selected.getAttribute("stroke-dasharray");
cur_properties.stroke_linejoin = selected.getAttribute("stroke-linejoin");
cur_properties.stroke_linecap = selected.getAttribute("stroke-linecap");
switch ( selected.tagName ) {
case "g":
case "use":
case "image":
case "foreignObject":
break;
default:
cur_properties.fill = selected.getAttribute("fill");
cur_properties.fill_opacity = selected.getAttribute("fill-opacity");
cur_properties.stroke = selected.getAttribute("stroke");
cur_properties.stroke_opacity = selected.getAttribute("stroke-opacity");
cur_properties.stroke_width = selected.getAttribute("stroke-width");
cur_properties.stroke_dasharray = selected.getAttribute("stroke-dasharray");
cur_properties.stroke_linejoin = selected.getAttribute("stroke-linejoin");
cur_properties.stroke_linecap = selected.getAttribute("stroke-linecap");
}
if (selected.tagName == "text") {
cur_text.font_size = selected.getAttribute("font-size");
cur_text.font_family = selected.getAttribute("font-family");