From 23069bfbfd7ebe00d0596d3c2f1799111fa1eb48 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 26 Aug 2009 19:09:13 +0000 Subject: [PATCH] First part of Issue 103: rotate handle on the selector box, doesn't do anything yet git-svn-id: http://svg-edit.googlecode.com/svn/trunk@476 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 486618f1..7a478d0f 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -226,7 +226,25 @@ function SvgCanvas(c) "sw":null, "w":null }; - + this.rotateGripConnector = this.selectorGroup.appendChild( addSvgElementFromJson({ + "element": "line", + "attr": { + "id": ("selectorGrip_rotate_connector_" + this.id), + "stroke": "blue", + "stroke-width": "1", + } + }) ); + this.rotateGrip = this.selectorGroup.appendChild( addSvgElementFromJson({ + "element": "circle", + "attr": { + "id": ("selectorGrip_rotate_" + this.id), + "fill": "lime", + "r": 4, + "stroke": "blue", + "stroke-width": 2 + } + }) ); + // add the corner grips for (dir in this.selectorGrips) { this.selectorGrips[dir] = this.selectorGroup.appendChild( @@ -255,9 +273,12 @@ function SvgCanvas(c) this.showGrips = function(show) { // TODO: use suspendRedraw() here + var bShow = show ? "inline" : "none"; for (dir in this.selectorGrips) { - this.selectorGrips[dir].setAttribute("display", show ? "inline" : "none"); + this.selectorGrips[dir].setAttribute("display", bShow); } + this.rotateGrip.setAttribute("display", bShow); + this.rotateGripConnector.setAttribute("display", bShow); }; // Updates cursors for corner grips on rotation so arrows point the right way @@ -316,6 +337,9 @@ function SvgCanvas(c) }); }); + assignAttributes(this.rotateGripConnector, { x1: l+w/2, y1: t-20, x2: l+w/2, y2: t }); + assignAttributes(this.rotateGrip, { cx: l+w/2, cy: t-20 }); + // empty out the transform attribute this.selectorGroup.setAttribute("transform", ""); this.selectorGroup.removeAttribute("transform");