From: Tuukka Lehtonen Date: Fri, 15 Nov 2019 07:22:14 +0000 (+0200) Subject: Set strokeWidth for new chart items already upon creation X-Git-Tag: v1.43.0~136^2~34 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=878d7a270f47ae61c606bbd7ea38d8dc6102db3b;p=simantics%2Fplatform.git Set strokeWidth for new chart items already upon creation gitlab #415 Change-Id: Ibc478abadc3c80006eee09b7daf568a9f43dd8b0 --- diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/query/AddChartItem.java b/bundles/org.simantics.charts/src/org/simantics/charts/query/AddChartItem.java index 62ef8781f..280f32f34 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/query/AddChartItem.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/query/AddChartItem.java @@ -94,6 +94,8 @@ public class AddChartItem extends WriteResultRequest> { graph.claim(chartItem, CHART.Chart_Item_Renderer, getRenderer(graph, desc.renderer)); int index = desc.index!=null ? desc.index : nextIndex++; graph.claimLiteral(chartItem, CHART.Chart_Item_Index, index); + if (desc.strokeWidth != null) + graph.claimLiteral(chartItem, G2DResource.getInstance(graph).HasStrokeWidth, desc.strokeWidth, Bindings.FLOAT); if (desc.color != null) graph.claimLiteral(chartItem, G2DResource.getInstance(graph).HasColor, desc.color, Bindings.FLOAT_ARRAY); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartItemDescriptor.java b/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartItemDescriptor.java index d4377f367..46b8202df 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartItemDescriptor.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/query/ChartItemDescriptor.java @@ -42,6 +42,7 @@ public class ChartItemDescriptor { public DrawMode drawMode = DrawMode.getDefault(); + public @Optional Float strokeWidth; public @Optional float[] color; } diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java b/bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java index 464a5beb5..4d2a1317a 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java @@ -178,6 +178,7 @@ public class AddVariableToChartAction implements Runnable { cid.max = data.max; cid.subscriptionItem = ns.subscriptionItem; cid.color = data.color; + cid.strokeWidth = data.strokeWidth; AddChartItem ci = new AddChartItem( chart, Collections.singletonList( cid ) ); Simantics.getSession().sync( ci ); }