public OpacitySpriteEdit(LevelMap map, double opacity, boolean isRelative) { super(); this.map = map; sprites = new ArrayList(map.selectedSprites); // save the sprites' old opacity for (int i = 0; i < sprites.size(); i++) { SpriteInstance sprite = sprites.get(i); oldOpacities.add(sprite.opacity); } // change the sprites' opacity and save their new opacity for (int i = 0; i < sprites.size(); i++) { SpriteInstance sprite = sprites.get(i); if (isRelative) sprite.opacity *= opacity; else sprite.opacity = opacity; sprite.setOpacity(sprite.opacity); newOpacities.add(sprite.opacity); } map.flagModified(); }
public void redo() { for (int i = 0; i < sprites.size(); i++) { SpriteInstance sprite = sprites.get(i); sprite.opacity = newOpacities.get(i); } map.flagModified(); }
public DropSpriteEdit(LevelMap map, SpriteType spriteType, Point loc) { super(); this.map = map; this.spriteType = spriteType; this.loc = loc; this.layer = map.selectedLayer; sprite = layer.dropSpriteType(spriteType, loc); map.flagModified(); }
public void redo() { layer.addSprite(sprite); sprite.isSelected = false; map.flagModified(); }
public void undo() { layer.removeSprite(sprite); sprite.isSelected = false; map.flagModified(); }