@Override protected void update(float percent, Entity entity, T actionData) { DimensionsComponent dimensionsComponent = ComponentRetriever.get(entity, DimensionsComponent.class); dimensionsComponent.width = actionData.startWidth + (actionData.endHeight - actionData.startWidth) * percent; dimensionsComponent.height = actionData.startHeight + (actionData.endHeight - actionData.startHeight) * percent; }
@Override public void undoAction() { Entity entity = EntityUtils.getByUniqueId(entityId); PolygonComponent polygonComponent = ComponentRetriever.get(entity, PolygonComponent.class); polygonComponent.vertices = dataFrom; // if it's image update polygon sprite data TextureRegionComponent textureRegionComponent = ComponentRetriever.get(entity, TextureRegionComponent.class); if (textureRegionComponent != null && textureRegionComponent.isPolygon) { DimensionsComponent dimensionsComponent = ComponentRetriever.get(entity, DimensionsComponent.class); dimensionsComponent.setPolygon(polygonComponent); textureRegionComponent.setPolygonSprite(polygonComponent); } Overlap2DFacade.getInstance().sendNotification(Overlap2D.ITEM_DATA_UPDATED, entity); }