Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Checks if a rectangle belongs in any of the existing groups
- */
- function removesFromGroup(group, tempRect) {
- /**
- * I created a bin group and I send the rectangle to this group by using group.moveTo(bin)
- */
- var bin = new Kinetic.Group({
- name:'bin',
- x : -480,
- y : -50
- });
- for (var j = 0; j < group.getChildren().length; j++) {
- // var groupCube_x = (groups[i].getChildren()[j]).getAbsolutePosition().x;
- if (group.getChildren()[j] == tempRect) {
- tempRect.moveTo(bin);
- // alert("Move to bin");
- //tempRect.remove();
- //tempRect.getParent().remove(bin);
- //bin.destroy();
- layer.draw();
- }
- }
- return false;
- }
- /**
- * Checks if a rectangle belongs in any of the existing groups and
- * destroys it if so.
- */
- function removesFromGroup(group, tempRect) {
- group.getChildren().forEach(function(child){
- if (child == tempRect) {
- tempRect.destroy();
- layer.draw();
- }
- });
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement