When a node has scale attribute set to zero and a mouse event is subsequently fired on the object, then a ClassCastException is reported in the log; however, the application does not crash.
Click once on the red rectangle and then click again on the very same spot to reproduce the error.
Workaround: Set the scale value to a very small value, e.g. 0.0001.
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
Stage {
width: 250
height: 250
scene: Scene {
content: Group {
var scale = 1.0;
content: [
Rectangle {
x: 10
y: 10
width: 40
height: 40
scaleX: bind scale
fill: Color.RED
onMouseReleased: function(e:MouseEvent) {
scale = 0.0;
}
}
]
}
}
}
Click once on the red rectangle and then click again on the very same spot to reproduce the error.
Workaround: Set the scale value to a very small value, e.g. 0.0001.
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
Stage {
width: 250
height: 250
scene: Scene {
content: Group {
var scale = 1.0;
content: [
Rectangle {
x: 10
y: 10
width: 40
height: 40
scaleX: bind scale
fill: Color.RED
onMouseReleased: function(e:MouseEvent) {
scale = 0.0;
}
}
]
}
}
}