feat(renderer): add lastControlDataUpdateTime handling to SliderControl
This commit is contained in:
@@ -352,6 +352,7 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
|||||||
((WindowPanelControl) control).setCustomData(this.windowPanelData);
|
((WindowPanelControl) control).setCustomData(this.windowPanelData);
|
||||||
}
|
}
|
||||||
else if (this.clazz == SliderControl.class && this.sliderData != null) {
|
else if (this.clazz == SliderControl.class && this.sliderData != null) {
|
||||||
|
((SliderControl) control).setLastControlDataUpdateTime(this.lastControlDataUpdateTime);
|
||||||
((SliderControl) control).setCustomData(this.sliderData);
|
((SliderControl) control).setCustomData(this.sliderData);
|
||||||
}
|
}
|
||||||
else if (this.clazz == TableControl.class && this.tableData != null) {
|
else if (this.clazz == TableControl.class && this.tableData != null) {
|
||||||
|
|||||||
@@ -24,16 +24,26 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
|
|||||||
|
|
||||||
protected Consumer<Double> actionConsumer;
|
protected Consumer<Double> actionConsumer;
|
||||||
|
|
||||||
|
protected long lastControlDataUpdateTime;
|
||||||
|
|
||||||
|
protected long lastControlDataUpdateTimeInternal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCustomData(final SliderData data) {
|
public void setCustomData(final SliderData data) {
|
||||||
if (data != null) {
|
if (data != null && this.lastControlDataUpdateTimeInternal < this.lastControlDataUpdateTime) {
|
||||||
this.setColor(data.color());
|
this.setColor(data.color());
|
||||||
this.setHorizontal(data.horizontal());
|
this.setHorizontal(data.horizontal());
|
||||||
this.setValue(data.value());
|
this.setValue(data.value());
|
||||||
this.setValue2(data.value2());
|
this.setValue2(data.value2());
|
||||||
|
this.lastControlDataUpdateTimeInternal = this.lastControlDataUpdateTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLastControlDataUpdateTime(final long time) {
|
||||||
|
this.lastControlDataUpdateTime = time;
|
||||||
|
}
|
||||||
|
|
||||||
public G2DSliderControlImpl() {
|
public G2DSliderControlImpl() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -140,7 +150,7 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
|
|||||||
|
|
||||||
protected void createControl() {
|
protected void createControl() {
|
||||||
this.control = new CustomSlider(event -> {
|
this.control = new CustomSlider(event -> {
|
||||||
this.lastValue = Double.parseDouble(event.getActionCommand());
|
this.setValue(Double.parseDouble(event.getActionCommand()));
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
this.performAction();
|
this.performAction();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,6 +183,8 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
|||||||
|
|
||||||
void setCustomData(SliderData data);
|
void setCustomData(SliderData data);
|
||||||
|
|
||||||
|
void setLastControlDataUpdateTime(long time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user