mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
Set undo levels to 50, got Image editor support working. Undo is 100% ready for testing!
This commit is contained in:
parent
47231d366b
commit
a460696cdf
|
@ -27,7 +27,7 @@ import org.jvnet.jaxb2_commons.lang.CopyTo2;
|
|||
* @author brobert
|
||||
*/
|
||||
public abstract class Editor<T, D> implements DataObserver<T> {
|
||||
public static final int UNDO_HISTORY_LENGTH = 20;
|
||||
public static final int UNDO_HISTORY_LENGTH = 50;
|
||||
LinkedList<T> undoStates = new LinkedList<>();
|
||||
|
||||
T editEntity;
|
||||
|
|
|
@ -61,6 +61,12 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
|||
return Platform.AppleII;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEntityUpdated() {
|
||||
super.onEntityUpdated();
|
||||
data = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildEditorUI(Pane editorAnchorPane) {
|
||||
anchorPane = editorAnchorPane;
|
||||
|
@ -145,28 +151,24 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
|||
currentImage = getPlatform().imageRenderer.renderImage(currentImage, getImageData(), getWidth(), getHeight());
|
||||
}
|
||||
|
||||
private byte[] imageData = null;
|
||||
|
||||
public byte[] getImageData() {
|
||||
if (imageData == null) {
|
||||
PlatformData data = getPlatformData(getPlatform());
|
||||
PlatformData data = null;
|
||||
public PlatformData getPlatformData() {
|
||||
if (data == null) {
|
||||
data = getPlatformData(getPlatform());
|
||||
if (data == null) {
|
||||
createNewPlatformImage(getPlatform().maxImageWidth, getPlatform().maxImageHeight);
|
||||
data = getPlatformData(getPlatform());
|
||||
}
|
||||
imageData = data.getValue();
|
||||
}
|
||||
return imageData;
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte[] getImageData() {
|
||||
return getPlatformData().getValue();
|
||||
}
|
||||
|
||||
public void setData(byte[] data) {
|
||||
imageData = data;
|
||||
for (PlatformData d : getEntity().getDisplayData()) {
|
||||
if (d.getPlatform().equalsIgnoreCase(getPlatform().name())) {
|
||||
d.setValue(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
getPlatformData().setValue(data);
|
||||
}
|
||||
|
||||
public void setDataAndRedraw(byte[] data) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user