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 void redo() { layer.addSprite(sprite); sprite.isSelected = false; map.flagModified(); }
public void undo() { layer.removeSprite(sprite); sprite.isSelected = false; map.flagModified(); }