ViewportPolicy fitToSize method reloads css [message #1795644] |
Wed, 26 September 2018 07:27  |
Eclipse User |
|
|
|
The method fitToSize in ViewportPolicy in my case is aimed to place the view in the center without zooming and it indeed works fine.
ViewportPolicy viewportPolicy = viewer.getRootPart().getAdapter(ViewportPolicy.class);
viewportPolicy.init();
viewportPolicy.fitToSize(1, 1);
ITransactionalOperation commit = viewportPolicy.commit();
try
{
viewer.getDomain().execute(commit, null);
}
catch (ExecutionException e)
{
e.printStackTrace();
}
But I noticed a side effect: it seems the styling for javafx.scene.text.Text node is reloaded. I have the following style definition for Text.
.text{
-fx-font-family: 'Roboto';
-fx-font-size: 14.0;
-fx-text-alignment: center;
}
I have registered a listener on the width property of its parent (Region) to handle something when the text is changed. The listener is triggered twice during the fitTosize without changing any text. For example, the width of text "Karlsruhe HBF" is changed: 89.23 -> 73.81 -> 89.23.
I guess the styling for Text is first set to default and then set to my defintion again. Is it true? This behavior is not desired since the listener is triggered twice for nothing. Is there other way to place the view in the middle? Thank you in Advance.
Best regards
Shenwei Zheng
|
|
|
|
Powered by
FUDForum. Page generated in 0.04496 seconds