private void drag(MouseEvent e) {
Node node = get();
if (isEnable() && pressedCorner != null && e.isConsumed() == false && node != null) {
double dx = e.getScreenX() - startX;
if (pressedCorner.horizontal == HorizontalDirection.RIGHT) {
width.set(MathUtil.toRange(startWidth + dx, minWidth.get(), maxWidth.get()));
} else if (pressedCorner.horizontal == HorizontalDirection.LEFT) {
width.set(MathUtil.toRange(startWidth - dx, minWidth.get(), maxWidth.get()));
node.setLayoutX(startWidth + startPosX - width.get());
}
double dy = e.getScreenY() - startY;
if (pressedCorner.vertical == VerticalDirection.DOWN) {
height.set(MathUtil.toRange(startHeight + dy, minHeight.get(), maxHeight.get()));
} else if (pressedCorner.vertical == VerticalDirection.UP) {
height.set(MathUtil.toRange(startHeight - dy, minHeight.get(), maxHeight.get()));
node.setLayoutY(startHeight + startPosY - height.get());
}
e.consume();
}
}
java类javafx.geometry.HorizontalDirection的实例源码
ResizeSupport.java 文件源码
项目:JavaFX-EX
阅读 24
收藏 0
点赞 0
评论 0
ResizeSupport.java 文件源码
项目:JavaFX-EX
阅读 32
收藏 0
点赞 0
评论 0
private void drag(MouseEvent e) {
Node node = get();
if (isEnable() && pressedCorner != null && e.isConsumed() == false && node != null) {
double dx = e.getScreenX() - startX;
if (pressedCorner.horizontal == HorizontalDirection.RIGHT) {
width.set(MathUtil.toRange(startWidth + dx, minWidth.get(), maxWidth.get()));
} else if (pressedCorner.horizontal == HorizontalDirection.LEFT) {
width.set(MathUtil.toRange(startWidth - dx, minWidth.get(), maxWidth.get()));
node.setLayoutX(startWidth + startPosX - width.get());
}
double dy = e.getScreenY() - startY;
if (pressedCorner.vertical == VerticalDirection.DOWN) {
height.set(MathUtil.toRange(startHeight + dy, minHeight.get(), maxHeight.get()));
} else if (pressedCorner.vertical == VerticalDirection.UP) {
height.set(MathUtil.toRange(startHeight - dy, minHeight.get(), maxHeight.get()));
node.setLayoutY(startHeight + startPosY - height.get());
}
e.consume();
}
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 27
收藏 0
点赞 0
评论 0
private void drawMarking(double value, HorizontalDirection side, double markWidth, String... styles) {
double y = getValueHeight(value);
double x = (side == HorizontalDirection.LEFT) ? (bottomRadius - topRadius - markWidth) : (bottomRadius + topRadius);
Line line = new Line(x, y, x + markWidth, y);
line.getStyleClass().setAll(Arrays.stream(styles).map(style -> style + "-marking").collect(Collectors.toList()));
pane.getChildren().add(line);
markings.add(line);
Text text = new Text(gauge.getFormattedValue(value));
text.setY(y + 4);
text.getStyleClass().setAll(Arrays.stream(styles).map(style -> style + "-text").collect(Collectors.toList()));
if(side == HorizontalDirection.LEFT) {
text.setTextAlignment(TextAlignment.RIGHT);
double wrappingWidth = restrain(2 * bottomRadius, 60, 240);
text.setWrappingWidth(wrappingWidth);
text.setX(x - wrappingWidth - 4);
} else {
text.setTextAlignment(TextAlignment.LEFT);
text.setX(x + markWidth + 4);
}
pane.getChildren().add(text);
markings.add(text);
}
PlayerControl.java 文件源码
项目:FXGL
阅读 29
收藏 0
点赞 0
评论 0
public PlayerControl() {
Texture staticTexture = FXGL.getAssetLoader()
.loadTexture("dude.png")
.subTexture(new Rectangle2D(0, 0, 32, 42));
animatedTexture = FXGL.getAssetLoader()
.loadTexture("dude.png")
.subTexture(new Rectangle2D(32, 0, 32*3, 42))
.superTexture(staticTexture, HorizontalDirection.RIGHT)
.toAnimatedTexture(4, Duration.seconds(0.5));
animWalk = animatedTexture.getAnimationChannel();
animStand = new AnimationChannel(animatedTexture.getImage(), 4, 32, 42, Duration.seconds(1), 1, 1);
animJump = new AnimationChannel(animatedTexture.getImage(), 4, 32, 42, Duration.seconds(0.75), 1, 1);;
animatedTexture.setAnimationChannel(animStand);
animatedTexture.start(FXGL.getApp().getStateMachine().getPlayState());
jumpTimer = FXGL.newLocalTimer();
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 24
收藏 0
点赞 0
评论 0
public StyleableObjectProperty<HorizontalDirection> rangePositionProperty() {
if (rangePosition == null) {
rangePosition = CssHelper.createProperty(StyleableProperties.RANGE_POSITION, this);
rangePosition.addListener(obs -> redraw());
}
return rangePosition;
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 27
收藏 0
点赞 0
评论 0
public StyleableObjectProperty<HorizontalDirection> thresholdPositionProperty() {
if (thresholdPosition == null) {
thresholdPosition = CssHelper.createProperty(StyleableProperties.THRESHOLD_POSITION, this);
thresholdPosition.addListener(obs -> redraw());
}
return thresholdPosition;
}
ResizeSupport.java 文件源码
项目:JavaFX-EX
阅读 26
收藏 0
点赞 0
评论 0
private Corner(Cursor cursor, HorizontalDirection horizontal, VerticalDirection vertical) {
this.cursor = cursor;
this.horizontal = horizontal;
this.vertical = vertical;
}
ResizeSupport.java 文件源码
项目:JavaFX-EX
阅读 25
收藏 0
点赞 0
评论 0
private Corner(Cursor cursor, HorizontalDirection horizontal, VerticalDirection vertical) {
this.cursor = cursor;
this.horizontal = horizontal;
this.vertical = vertical;
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 32
收藏 0
点赞 0
评论 0
public HorizontalDirection getRangePosition() {
return rangePosition == null ? DEFAULT_RANGE_POSITION : rangePosition.get();
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 27
收藏 0
点赞 0
评论 0
public void setRangePosition(HorizontalDirection newPosition) {
rangePosition.set(newPosition);
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 25
收藏 0
点赞 0
评论 0
public HorizontalDirection getThresholdPosition() {
return thresholdPosition == null ? DEFAULT_THRESHOLD_POSITION : thresholdPosition.get();
}
ThermometerSkin.java 文件源码
项目:jfxgauge
阅读 25
收藏 0
点赞 0
评论 0
public void setThresholdPosition(HorizontalDirection newPosition) {
thresholdPosition.set(newPosition);
}