[ka-Map-dev] [Bug 1571] kaMap.js removeObject not working for all
objects
bugzilla-daemon at bugzilla.maptools.org
bugzilla-daemon at bugzilla.maptools.org
Wed Aug 30 08:27:57 EDT 2006
http://bugzilla.maptools.org/show_bug.cgi?id=1571
pspencer at dmsolutions.ca changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From pspencer at dmsolutions.ca 2006-08-30 08:27 -------
modified code as follows:
/**
* kaMap.removeObject( obj )
*
* removes an object previously added with one of the addObjectXxx calls
*
* obj - object, an object that has been previously added, or null to remove
* all objects
*
* returns true if the object was removed, false otherwise (i.e. if it was
* never added).
*/
kaMap.prototype.removeObject = function( obj ) {
var bRemoveAll = (obj == null);
for (var i=0; i<this.aObjects.length; i++) {
if (this.aObjects[i] == obj || obj == null) {
if (!obj) {
obj = this.aObjects[i];
}
if (obj.canvas) {
obj.canvas.removeChild( obj );
obj.canvas = null;
}
this.aObjects.splice(i,1);
if (!bRemoveAll) {
return true;
}
}
}
return false;
};
/**
* kaMap.removeAllObjects( canvas )
*
* removes all objects on a particular canvas
*
* canvas - a canvas that was previously created with createDrawingCanvas
*/
kaMap.prototype.removeAllObjects = function(canvas) {
for (var i=0; i<this.aObjects.length; i++) {
obj = this.aObjects[i];
if (obj.canvas && obj.canvas == canvas) {
obj.canvas.removeChild( obj );
obj.canvas = null;
this.aObjects.splice(i--,1);
}
}
return true;
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Please do NOT reply to this email, use the link above instead to
login to bugzilla and submit your comment. Any email reply to this
address will be lost.
More information about the ka-Map-dev
mailing list