Sensor component custom width/height
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
- Update libGDX to 1.12.0
|
||||
- Update gradle to 7.6
|
||||
- Replace PureMVC with gdx-puremvc
|
||||
- Sensor component custom width/height
|
||||
- Bug fixing and stability improvements
|
||||
|
||||
**Runtime**
|
||||
|
||||
Submodule hyperlap2d-runtime-libgdx updated: 327be0455d...334a64c112
+10
@@ -43,6 +43,11 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand {
|
||||
sensorComponent.rightSpanPercent = vo.rightSpanPercent;
|
||||
sensorComponent.topSpanPercent = vo.topSpanPercent;
|
||||
|
||||
sensorComponent.bottomHeightPercent = vo.bottomHeightPercent;
|
||||
sensorComponent.leftWidthPercent = vo.leftWidthPercent;
|
||||
sensorComponent.rightWidthPercent = vo.rightWidthPercent;
|
||||
sensorComponent.topHeightPercent = vo.topHeightPercent;
|
||||
|
||||
Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity);
|
||||
}
|
||||
|
||||
@@ -61,6 +66,11 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand {
|
||||
sensorComponent.rightSpanPercent = backup.rightSpanPercent;
|
||||
sensorComponent.topSpanPercent = backup.topSpanPercent;
|
||||
|
||||
sensorComponent.bottomHeightPercent = backup.bottomHeightPercent;
|
||||
sensorComponent.leftWidthPercent = backup.leftWidthPercent;
|
||||
sensorComponent.rightWidthPercent = backup.rightWidthPercent;
|
||||
sensorComponent.topHeightPercent = backup.topHeightPercent;
|
||||
|
||||
Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity);
|
||||
}
|
||||
|
||||
|
||||
+55
-4
@@ -28,6 +28,11 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
private VisValidatableTextField sensorSpanPercentLeft;
|
||||
private VisValidatableTextField sensorSpanPercentRight;
|
||||
private VisValidatableTextField sensorSpanPercentTop;
|
||||
|
||||
private VisValidatableTextField sensorHeightPercentBottom;
|
||||
private VisValidatableTextField sensorWidthPercentLeft;
|
||||
private VisValidatableTextField sensorWidthPercentRight;
|
||||
private VisValidatableTextField sensorHeightPercentTop;
|
||||
|
||||
public UISensorProperties() {
|
||||
super("Physics Sensors");
|
||||
@@ -50,6 +55,11 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
sensorSpanPercentRight = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
sensorSpanPercentTop = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
|
||||
sensorHeightPercentBottom = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
sensorWidthPercentLeft = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
sensorWidthPercentRight = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
sensorHeightPercentTop = StandardWidgetsFactory.createValidableTextField(floatValidator);
|
||||
|
||||
mainTable.add(new VisLabel("Add sensors to body:", Align.left)).padRight(5).colspan(2).fillX();
|
||||
mainTable.row().padTop(5);
|
||||
|
||||
@@ -57,16 +67,28 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
VisTable sensorTable = new VisTable();
|
||||
sensorTable.defaults().left();
|
||||
sensorTable.add(sensorTop).padRight(5);
|
||||
sensorTable.add("W:");
|
||||
sensorTable.add(sensorSpanPercentTop).width(50).padRight(5);
|
||||
sensorTable.add("H:");
|
||||
sensorTable.add(sensorHeightPercentTop).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorLeft).padRight(5);
|
||||
sensorTable.add("H:");
|
||||
sensorTable.add(sensorSpanPercentLeft).width(50).padRight(5);
|
||||
sensorTable.add("W:");
|
||||
sensorTable.add(sensorWidthPercentLeft).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorRight).padRight(5);
|
||||
sensorTable.add("H:");
|
||||
sensorTable.add(sensorSpanPercentRight).width(50).padRight(5);
|
||||
sensorTable.add("W:");
|
||||
sensorTable.add(sensorWidthPercentRight).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorBottom).padRight(5);
|
||||
sensorTable.add("W:");
|
||||
sensorTable.add(sensorSpanPercentBottom).width(50).padRight(5);
|
||||
sensorTable.add("H:");
|
||||
sensorTable.add(sensorHeightPercentBottom).width(50).padRight(5);
|
||||
|
||||
mainTable.add(sensorTable).padBottom(5).colspan(2);
|
||||
mainTable.row().padTop(5);
|
||||
@@ -76,10 +98,18 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
* Initializes the tooltips.
|
||||
*/
|
||||
private void initTooltip() {
|
||||
StandardWidgetsFactory.addTooltip(sensorBottom, "Adds a sensor to the bottom of the body. The value gives the percentage of the body width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorLeft, "Adds a sensor to the left of the body. The value gives the percentage of the body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorRight, "Adds a sensor to the right of the body. The value gives the percentage of the body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorTop, "Adds a sensor to the top of the body. The value gives the percentage of the body width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorBottom, "Adds a sensor to the bottom of the body.");
|
||||
StandardWidgetsFactory.addTooltip(sensorSpanPercentBottom, "The value gives the percentage of the body sensor width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorHeightPercentBottom, "The value gives the percentage of the body sensor height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorLeft, "Adds a sensor to the left of the body.");
|
||||
StandardWidgetsFactory.addTooltip(sensorSpanPercentLeft, "The value gives the percentage of the body sensor height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorWidthPercentLeft, "The value gives the percentage of the body sensor width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorRight, "Adds a sensor to the right of the body.");
|
||||
StandardWidgetsFactory.addTooltip(sensorSpanPercentRight, "The value gives the percentage of the body sensor height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorWidthPercentRight, "The value gives the percentage of the body sensor width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorTop, "Adds a sensor to the top of the body.");
|
||||
StandardWidgetsFactory.addTooltip(sensorSpanPercentTop, "The value gives the percentage of the body sensor width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorHeightPercentTop, "The value gives the percentage of the body sensor height where 1.0 equals 100%.");
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
@@ -92,6 +122,11 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
sensorSpanPercentLeft.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
sensorSpanPercentRight.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
sensorSpanPercentTop.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
|
||||
sensorHeightPercentBottom.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
sensorWidthPercentLeft.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
sensorWidthPercentRight.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
sensorHeightPercentTop.addListener(new KeyboardListener(getUpdateEventName()));
|
||||
}
|
||||
|
||||
public VisCheckBox getSensorBottomBox() {
|
||||
@@ -126,6 +161,22 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
return sensorSpanPercentTop;
|
||||
}
|
||||
|
||||
public VisTextField getSensorHeightPercentBottomTextfield() {
|
||||
return sensorHeightPercentBottom;
|
||||
}
|
||||
|
||||
public VisTextField getSensorWidthPercentLeftTextfield() {
|
||||
return sensorWidthPercentLeft;
|
||||
}
|
||||
|
||||
public VisTextField getSensorWidthPercentRightTextfield() {
|
||||
return sensorWidthPercentRight;
|
||||
}
|
||||
|
||||
public VisTextField getSensorHeightPercentTopTextfield() {
|
||||
return sensorHeightPercentTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove() {
|
||||
Facade.getInstance().sendNotification(CLOSE_CLICKED);
|
||||
|
||||
+10
@@ -59,6 +59,11 @@ public class UISensorPropertiesMediator extends UIItemPropertiesMediator<UISenso
|
||||
viewComponent.getSensorSpanPercentLeftTextfield().setText(Float.toString(sensorComponent.leftSpanPercent));
|
||||
viewComponent.getSensorSpanPercentRightTextfield().setText(Float.toString(sensorComponent.rightSpanPercent));
|
||||
viewComponent.getSensorSpanPercentTopTextfield().setText(Float.toString(sensorComponent.topSpanPercent));
|
||||
|
||||
viewComponent.getSensorHeightPercentBottomTextfield().setText(Float.toString(sensorComponent.bottomHeightPercent));
|
||||
viewComponent.getSensorWidthPercentLeftTextfield().setText(Float.toString(sensorComponent.leftWidthPercent));
|
||||
viewComponent.getSensorWidthPercentRightTextfield().setText(Float.toString(sensorComponent.rightWidthPercent));
|
||||
viewComponent.getSensorHeightPercentTopTextfield().setText(Float.toString(sensorComponent.topHeightPercent));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +85,11 @@ public class UISensorPropertiesMediator extends UIItemPropertiesMediator<UISenso
|
||||
payloadVo.rightSpanPercent = NumberUtils.toFloat(viewComponent.getSensorSpanPercentRightTextfield().getText());
|
||||
payloadVo.topSpanPercent = NumberUtils.toFloat(viewComponent.getSensorSpanPercentTopTextfield().getText());
|
||||
|
||||
payloadVo.bottomHeightPercent = NumberUtils.toFloat(viewComponent.getSensorHeightPercentBottomTextfield().getText());
|
||||
payloadVo.leftWidthPercent = NumberUtils.toFloat(viewComponent.getSensorWidthPercentLeftTextfield().getText());
|
||||
payloadVo.rightWidthPercent = NumberUtils.toFloat(viewComponent.getSensorWidthPercentRightTextfield().getText());
|
||||
payloadVo.topHeightPercent = NumberUtils.toFloat(viewComponent.getSensorHeightPercentTopTextfield().getText());
|
||||
|
||||
if (!oldPayloadVo.equals(payloadVo)) {
|
||||
Object payload = UpdateSensorDataCommand.payload(observableReference, payloadVo);
|
||||
facade.sendNotification(MsgAPI.ACTION_UPDATE_SENSOR_DATA, payload);
|
||||
|
||||
Reference in New Issue
Block a user