我使用javafx圆形开发了笔功能。问题是当我快速绘制时,绘制的线或任何形状都会变成离散线。
函数的相关代码部分:
Pane freePane = new Pane();
freePane.setOnMouseDragged(e1->{
switch(e1.getButton()){
case PRIMARY:
CircleContainer.push(new Circle(e1.getSceneX(),e1.getSceneY(),5,colorValue));
freePane.getChildren().add((Circle)CircleContainer.peek()); penCounter++;break;
case SECONDARY:
eraser.realEraser(e1,20);break;
}
});
freePane.setOnMouseClicked(e2->{
switch(e2.getButton()){
case PRIMARY:
CircleContainer.push(new Circle(e2.getSceneX(),e2.getSceneY(),5,colorValue));
freePane.getChildren().add((Circle)CircleContainer.peek()); penCounter++;break;
}
问题的屏幕截图: