Skip to content

Commit

Permalink
Merge pull request #10 from nextbreakpoint/development
Browse files Browse the repository at this point in the history
Fix bug in Julia/Mandelbrot selector
  • Loading branch information
nextbreakpoint authored Nov 19, 2017
2 parents 601fded + 6a19c48 commit 550dbaa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public class BooleanObservableValue extends ObservableValueBase<Boolean> {
private Boolean value = Boolean.FALSE;

public void setValue(Boolean value) {
this.value = value;
fireValueChangedEvent();
if ((value != null && !value.equals(this.value)) || (value == null && this.value != null)) {
this.value = value;
fireValueChangedEvent();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public class StringObservableValue extends ObservableValueBase<String> {
private String value;

public void setValue(String value) {
this.value = value;
fireValueChangedEvent();
if ((value != null && !value.equals(this.value)) || (value == null && this.value != null)) {
this.value = value;
fireValueChangedEvent();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public void setTime(MandelbrotMetadata metadata, boolean continuous, boolean app
zoominButton.setSelected(true);
}
showPreviewProperty.setValue(false);
eventBus.postEvent("render-data-changed", new MandelbrotSession(mandelbrotSession.getScript(), createMetadataWithOptions()), false, false);
// eventBus.postEvent("render-data-changed", new MandelbrotSession(mandelbrotSession.getScript(), createMetadataWithOptions()), false, false);
}
juliaButton.setSelected(newValue);
// pickButton.setDisable(newValue);
Expand Down Expand Up @@ -604,9 +604,9 @@ public void setTime(MandelbrotMetadata metadata, boolean continuous, boolean app

eventBus.subscribe("session-data-changed", event -> updateData((MandelbrotSession) event[0], (Boolean) event[1], (Boolean) event[2]));

eventBus.subscribe("session-data-changed", event -> restoreView());
eventBus.subscribe("session-data-changed", event -> restoreView((MandelbrotSession) event[0]));

eventBus.subscribe("session-data-changed", event -> updateJulia());
eventBus.subscribe("session-data-changed", event -> updateJulia((MandelbrotSession) event[0]));

eventBus.subscribe("capture-clips-start", event -> playback = true);

Expand All @@ -616,11 +616,11 @@ public void setTime(MandelbrotMetadata metadata, boolean continuous, boolean app

eventBus.subscribe("playback-data-load", event -> loadData((MandelbrotSession) event[0], (Boolean) event[1], (Boolean) event[2]));

eventBus.subscribe("playback-data-load", event -> restoreView());
eventBus.subscribe("playback-data-load", event -> restoreView((MandelbrotSession) event[0]));

eventBus.subscribe("playback-data-change", event -> updateData((MandelbrotSession) event[0], (Boolean) event[1], (Boolean) event[2]));

eventBus.subscribe("playback-data-change", event -> restoreView());
eventBus.subscribe("playback-data-change", event -> restoreView((MandelbrotSession) event[0]));

eventBus.subscribe("editor-source-changed", event -> {
// MandelbrotSession newSession = new MandelbrotSession((String) event[0], (MandelbrotMetadata) mandelbrotSession.getMetadata());
Expand Down Expand Up @@ -731,8 +731,8 @@ private void loadData(MandelbrotSession session, Boolean continuous, boolean tim
});
}

private void updateJulia() {
MandelbrotMetadata metadata = (MandelbrotMetadata) mandelbrotSession.getMetadata();
private void updateJulia(MandelbrotSession mandelbrotSession) {
MandelbrotMetadata metadata = (MandelbrotMetadata) this.mandelbrotSession.getMetadata();
juliaProperty.setValue(metadata.isJulia());
}

Expand All @@ -759,7 +759,7 @@ private void updateData(MandelbrotSession session, Boolean continuous, Boolean t
updateSession(session, continuous, timeAnimation);
}

private void restoreView() {
private void restoreView(MandelbrotSession mandelbrotSession) {
MandelbrotMetadata metadata = (MandelbrotMetadata) mandelbrotSession.getMetadata();
showPreviewProperty.setValue(!metadata.isJulia() && metadata.getOptions().isShowPreview());
showOrbitProperty.setValue(metadata.getOptions().isShowOrbit());
Expand Down

0 comments on commit 550dbaa

Please sign in to comment.