Closed DJViking closed 5 years ago
Strange problems with Gauge sections and tick labels when placed in ScrollPane.
PLAIN_AMP Setting value after application shown: Sections and ticks are wrong:
Setting value before application shown: Sections and ticks are correct:
SIMPLE Setting value before application shown: Sections and ticks are wrong and value is wrong:
Setting value before application shown: Sections and ticks are wrong and value is correct:
This shows a PLAN_AMP and SIMPLE correctly without ScrollPane:
The PLAIN_AMP gets correct sections and ticks in either case If I set the ScrollPane fit-to-width and fit-to-height true. However SIMPLE does not.
The test application:
import javafx.application.Application; import javafx.geometry.Orientation; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.stage.Stage; import eu.hansolo.medusa.Gauge; import eu.hansolo.medusa.Gauge.SkinType; import eu.hansolo.medusa.GaugeBuilder; import eu.hansolo.medusa.Section; public class GaugeTest extends Application { public static void main(String[] argv) { GaugeTest.launch(); } @Override public void start(Stage stage) throws Exception { final BorderPane root = new BorderPane(); final ScrollPane scroll = new ScrollPane(); scroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scroll.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); root.setCenter(scroll); final HBox box = new HBox(); scroll.setContent(box); Gauge gauge1 = GaugeBuilder.create() .skinType(SkinType.PLAIN_AMP) // .skinType(SkinType.SIMPLE) .areasVisible(true) .sectionsVisible(true) .decimals(2) .build(); gauge1.setPrefWidth(500); gauge1.setMinValue(-70.0); gauge1.setMaxValue(5.0); gauge1.setSections(new Section(-70, -50, Color.web("#fffd5b")), new Section(-50, -5, Color.web("#39cc74")), new Section(-5, 0, Color.web("#fffd5b")), new Section(0, 5, Color.web("#fb4a4a"))); Gauge gauge2 = GaugeBuilder.create() .skinType(SkinType.PLAIN_AMP) // .skinType(SkinType.SIMPLE) .areasVisible(true) .sectionsVisible(true) .decimals(2) .build(); gauge2.setPrefWidth(500); gauge2.setMinValue(-5.0); gauge2.setMaxValue(50.0); gauge2.setSections(new Section(-5, 5, Color.web("#fffd5b")), new Section(5, 50, Color.web("#39cc74"))); box.getChildren().addAll(gauge1, gauge2); // gauge1.setValue(-35.0); // gauge2.setValue(4.0); stage.setScene(new Scene(root)); stage.setWidth(1000); stage.setHeight(600); stage.setTitle("GaugeTest"); stage.show(); gauge1.setValue(-35.0); gauge2.setValue(4.0); } }
It seems to be a regression from 8.0.
Running 8.0
Running 8.2
Should be fixed with commit #0a2590246efefbd54f4b15522bd31520b43729ab
Strange problems with Gauge sections and tick labels when placed in ScrollPane.
PLAIN_AMP Setting value after application shown: Sections and ticks are wrong:![screenshot_20190204_132411](https://user-images.githubusercontent.com/3070076/52208368-b0e17000-2880-11e9-9075-ba59d09e8827.png)
Setting value before application shown: Sections and ticks are correct:![screenshot_20190204_132408](https://user-images.githubusercontent.com/3070076/52208378-be96f580-2880-11e9-9856-26dc41236a52.png)
SIMPLE Setting value before application shown: Sections and ticks are wrong and value is wrong:![screenshot_20190204_132415](https://user-images.githubusercontent.com/3070076/52208432-eab27680-2880-11e9-9144-6073d243c890.png)
Setting value before application shown: Sections and ticks are wrong and value is correct:![screenshot_20190204_132418](https://user-images.githubusercontent.com/3070076/52208437-f00fc100-2880-11e9-9cc1-21bc3da68c23.png)
This shows a PLAN_AMP and SIMPLE correctly without ScrollPane:
![screenshot_20190204_132424](https://user-images.githubusercontent.com/3070076/52208475-1b92ab80-2881-11e9-9ae6-aafcbb8b8665.png)
The PLAIN_AMP gets correct sections and ticks in either case If I set the ScrollPane fit-to-width and fit-to-height true. However SIMPLE does not.
The test application: