More minor tweaks, still no multi-select
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@233 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -221,8 +221,9 @@ function SvgCanvas(c)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: consider a map of SVG elements to their selectors in the manager for
|
// TODO: add accessor methods to determine number of currently selected elements
|
||||||
// quick access to the selector in question (as opposed to looping through the array)
|
// TODO: move selectElement into SelectorManager and allow multiple selected elements
|
||||||
|
// with each call
|
||||||
function SelectorManager() {
|
function SelectorManager() {
|
||||||
|
|
||||||
// this will hold the <g> element that contains all selector rects/grips
|
// this will hold the <g> element that contains all selector rects/grips
|
||||||
@@ -233,6 +234,9 @@ function SvgCanvas(c)
|
|||||||
|
|
||||||
// this will hold objects of type Selector (see above)
|
// this will hold objects of type Selector (see above)
|
||||||
this.selectors = [];
|
this.selectors = [];
|
||||||
|
|
||||||
|
// this holds a map of SVG elements to their Selector object
|
||||||
|
this.selectorMap = {};
|
||||||
|
|
||||||
// local reference to this object
|
// local reference to this object
|
||||||
var mgr = this;
|
var mgr = this;
|
||||||
@@ -261,6 +265,7 @@ function SvgCanvas(c)
|
|||||||
// if we reached here, no available selectors were found, we create one
|
// if we reached here, no available selectors were found, we create one
|
||||||
this.selectors[N] = new Selector(N, elem);
|
this.selectors[N] = new Selector(N, elem);
|
||||||
this.selectorParentGroup.appendChild(this.selectors[N].selectorGroup);
|
this.selectorParentGroup.appendChild(this.selectors[N].selectorGroup);
|
||||||
|
this.selectorMap[elem] = this.selectors[N];
|
||||||
return this.selectors[N];
|
return this.selectors[N];
|
||||||
};
|
};
|
||||||
this.releaseSelector = function(sel) {
|
this.releaseSelector = function(sel) {
|
||||||
@@ -270,6 +275,7 @@ function SvgCanvas(c)
|
|||||||
if (sel.locked == false) {
|
if (sel.locked == false) {
|
||||||
console.log("WARNING! selector was released but was already unlocked");
|
console.log("WARNING! selector was released but was already unlocked");
|
||||||
}
|
}
|
||||||
|
delete this.selectorMap[sel.selectedElement];
|
||||||
sel.locked = false;
|
sel.locked = false;
|
||||||
sel.selectedElement = null;
|
sel.selectedElement = null;
|
||||||
|
|
||||||
@@ -606,7 +612,7 @@ function SvgCanvas(c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do not show resize grips on text elements
|
// do not show resize grips on text elements
|
||||||
theSelector.showGrips(selected.tagName != "text");
|
theSelector.showGrips(selected.tagName != "text" && current_mode != "multiselect");
|
||||||
}
|
}
|
||||||
|
|
||||||
call("selected", selected);
|
call("selected", selected);
|
||||||
|
|||||||
Reference in New Issue
Block a user