From a4f00f9c53c9ba7d55e5a58f1c03fde14b2fa581 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Sat, 5 Sep 2009 22:20:36 +0000 Subject: [PATCH] Issue 40: Fix selection of groups git-svn-id: http://svg-edit.googlecode.com/svn/trunk@602 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index f1a319ef..0cf09ccc 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -6,9 +6,8 @@ if(!window.console) { } // this defines which elements and attributes that we support -// TODO: add elements to this // TODO: add elements to this -// TODO: add xmlns:xlink attr to element +// TODO: add to this var svgWhiteList = { "circle": ["cx", "cy", "fill", "fill-opacity", "id", "opacity", "r", "stroke", "stroke-dasharray", "stroke-opacity", "stroke-width", "transform"], "defs": [], @@ -1260,6 +1259,12 @@ function BatchCommand(text) { started = true; current_resize_mode = "none"; var t = evt.target; + // if this element is in a group, go up until we reach the top-level group + while (t.parentNode.tagName == "g") { + t = t.parentNode; + } + // TODO: once we implement Layers, the top-level groups will be layers so + // we will want to stop just before then // WebKit returns
when the canvas is clicked, Firefox/Opera return var nodeName = t.nodeName.toLowerCase(); if (nodeName != "div" && nodeName != "svg") {