Java 类javafx.geometry.HorizontalDirection 实例源码

项目:JavaFX-EX    文件:ResizeSupport.java   
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();
  }
}
项目:JavaFX-EX    文件:ResizeSupport.java   
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();
  }
}
项目:jfxgauge    文件:ThermometerSkin.java   
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);
}
项目:FXGL    文件:PlayerControl.java   
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();
}
项目:jfxgauge    文件:ThermometerSkin.java   
public StyleableObjectProperty<HorizontalDirection> rangePositionProperty() {
    if (rangePosition == null) {
        rangePosition = CssHelper.createProperty(StyleableProperties.RANGE_POSITION, this);
        rangePosition.addListener(obs -> redraw());
    }
    return rangePosition;
}
项目:jfxgauge    文件:ThermometerSkin.java   
public StyleableObjectProperty<HorizontalDirection> thresholdPositionProperty() {
    if (thresholdPosition == null) {
        thresholdPosition = CssHelper.createProperty(StyleableProperties.THRESHOLD_POSITION, this);
        thresholdPosition.addListener(obs -> redraw());
    }
    return thresholdPosition;
}
项目:JavaFX-EX    文件:ResizeSupport.java   
private Corner(Cursor cursor, HorizontalDirection horizontal, VerticalDirection vertical) {
  this.cursor = cursor;
  this.horizontal = horizontal;
  this.vertical = vertical;
}
项目:JavaFX-EX    文件:ResizeSupport.java   
private Corner(Cursor cursor, HorizontalDirection horizontal, VerticalDirection vertical) {
  this.cursor = cursor;
  this.horizontal = horizontal;
  this.vertical = vertical;
}
项目:jfxgauge    文件:ThermometerSkin.java   
public HorizontalDirection getRangePosition() {
    return rangePosition == null ? DEFAULT_RANGE_POSITION : rangePosition.get();
}
项目:jfxgauge    文件:ThermometerSkin.java   
public void setRangePosition(HorizontalDirection newPosition) {
    rangePosition.set(newPosition);
}
项目:jfxgauge    文件:ThermometerSkin.java   
public HorizontalDirection getThresholdPosition() {
    return thresholdPosition == null ? DEFAULT_THRESHOLD_POSITION : thresholdPosition.get();
}
项目:jfxgauge    文件:ThermometerSkin.java   
public void setThresholdPosition(HorizontalDirection newPosition) {
    thresholdPosition.set(newPosition);
}