Please take a look at the following Link
I have the following code:
// hide all anchors
var children = group.getChildren();
for(var k=1; k < children.length; k++)
children[k].hide(); // .remove() would also work, or .destroy()
group.on("click", function() {
var id = this.getId();
if(imageSelected !== false)
{
// hide all anchors
var children = this.getChildren();
for(var k=1; k < children.length; k++)
children[k].hide(); // .remove() would also work, or .destroy()
layer.draw();
imageSelected = false;
}
else
{
var children = this.getChildren();
for(var k=1; k < children.length; k++)
children[k].show();
layer.draw();
imageSelected = id;
}
});
group.on("dragend", function() {
var children = this.getChildren();
for(var k=1; k < children.length; k++)
children[k].show();
layer.draw();
var id = this.getId();
imageSelected = id;
});
(Note: imageSelected should only contain the current group ID) I think my code has gone a bit pear-shaped.
Basically, if the user clicks the darth vader image - then the anchors must appear on darth vader only. When they click the darth vader image again - then the anchors must disappear (ie no anchors on the screen)
If darth vader is selected and the user clicks yoda, then the anchors around darth vader must disappear. They should then appear around yoda.
So far I can only hide anchors of the current group - which isn't very good!
Can anyone see where I have gone wrong?
Thanks for any help!