当前位置: 首页>>代码示例>>Java>>正文


Java Node.setScaleY方法代码示例

本文整理汇总了Java中javafx.scene.Node.setScaleY方法的典型用法代码示例。如果您正苦于以下问题:Java Node.setScaleY方法的具体用法?Java Node.setScaleY怎么用?Java Node.setScaleY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Node的用法示例。


在下文中一共展示了Node.setScaleY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scaleAll

import javafx.scene.Node; //导入方法依赖的package包/类
private static void scaleAll(Scene scene, Node node) {
    double translateX = node.getTranslateX();
    double translateY = node.getTranslateY();
    double baseX = node.getBoundsInParent().getMinX();
    double baseY = node.getBoundsInParent().getMinY();
    double sceneWidth = scene.getWidth();
    double sceneHeight = scene.getHeight();
    ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> {
        node.setScaleX(newValue.doubleValue() / sceneWidth);
        node.setTranslateX(translateX + (baseX * newValue.doubleValue() / sceneWidth) - baseX);
    };

    scene.widthProperty().addListener(widthResizer);
    ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> {
        node.setScaleY(newValue.doubleValue() / sceneHeight);
        node.setTranslateY(translateY + (baseY * newValue.doubleValue() / sceneHeight) - baseY);
    };
    scene.heightProperty().addListener(heightResizer);

}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:21,代码来源:BaseController.java

示例2: zoomInAndCenter

import javafx.scene.Node; //导入方法依赖的package包/类
private static void zoomInAndCenter(Node node, double initialWidth, double initialHeight, boolean preserveRatio) {
    Parent parent = node.getParent();

    node.toFront();

    Bounds parentBoundsInParent = parent.getBoundsInLocal();

    double xScaleRatio = parentBoundsInParent.getMaxX() / initialWidth;
    double yScaleRatio = parentBoundsInParent.getMaxY() / initialHeight;

    if (preserveRatio) {
        double bestScaleRatio = Math.min(xScaleRatio, yScaleRatio);
        node.setScaleX(bestScaleRatio);
        node.setScaleY(bestScaleRatio);
    } else {
        node.setScaleX(xScaleRatio);
        node.setScaleY(yScaleRatio);
    }

    Bounds boundsInParent = node.getBoundsInParent();

    double translateX = -1 * Math.abs(boundsInParent.getMinY());
    double translateY = -1 * Math.abs(boundsInParent.getMinY());

    node.setTranslateX(translateX);
    node.setTranslateY(translateY);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:28,代码来源:StatsDisplay.java

示例3: draw

import javafx.scene.Node; //导入方法依赖的package包/类
protected void draw (Node node, Drawable sprite) {
    Coordinate location = sprite.getLocation();
    node.relocate(getScale().scale(location.getX()) -
                  sprite.getDrawer().getGraphic().getHeight().get() / 2,
                  getScale().scale(location.getY()) - sprite.getDrawer().getGraphic()
                          .getHeight().get() / 2);
    node.setScaleX(getScale().getScale());
    node.setScaleY(getScale().getScale());
    node.setVisible(sprite.getDrawer().isVisible());
    node.setRotate(sprite.getOrientation());
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:12,代码来源:LevelRenderer.java

示例4: setupValuePane

import javafx.scene.Node; //导入方法依赖的package包/类
private Pane setupValuePane(Dimension<?> dimension, Label titleLabel, Pane contentPane) {
	final HBox titlePane = new HBox();
	final VBox valueVBox = new VBox();
	final Node backValueGraphicNode = new ImageView(backValueGraphic);
	final double buttonScale = 0.66;
	backValueGraphicNode.setScaleX(1 / buttonScale);
	backValueGraphicNode.setScaleY(1 / buttonScale);
	final Button backValue = new Button("", backValueGraphicNode);
	backValue.setOnAction((e) -> {
		traceExplorer.backValue(dimension);
	});
	backValue.setScaleX(buttonScale);
	backValue.setScaleY(buttonScale);
	backValue.setDisable(!traceExplorer.canBackValue(dimension));
	final Node stepValueGraphicNode = new ImageView(stepValueGraphic);
	stepValueGraphicNode.setScaleX(1 / buttonScale);
	stepValueGraphicNode.setScaleY(1 / buttonScale);
	final Button stepValue = new Button("", stepValueGraphicNode);
	stepValue.setOnAction((e) -> {
		traceExplorer.stepValue(dimension);
	});
	stepValue.setDisable(!traceExplorer.canStepValue(dimension));
	stepValue.setScaleX(buttonScale);
	stepValue.setScaleY(buttonScale);
	titlePane.setAlignment(Pos.CENTER_LEFT);
	VBox.setMargin(titlePane, HALF_MARGIN_INSETS);
	VBox.setMargin(contentPane, MARGIN_INSETS);

	final CheckBox showValueCheckBox = new CheckBox();
	showValueCheckBox.setScaleX(buttonScale);
	showValueCheckBox.setScaleY(buttonScale);
	boolean hide = traceExtractor.isDimensionIgnored(dimension);
	if (hide) {
		showValueCheckBox.setSelected(false);
	} else {
		showValueCheckBox.setSelected(true);
	}
	BooleanProperty sel = showValueCheckBox.selectedProperty();
	backValue.visibleProperty().bind(sel);
	stepValue.visibleProperty().bind(sel);
	sel.addListener((v, o, n) -> {
		if (o != n) {
			traceExtractor.ignoreDimension(dimension, !n);
			if (n) {
				valueVBox.getChildren().add(contentPane);
			} else {
				valueVBox.getChildren().remove(contentPane);
			}
			sortValueLines();
		}
	});
	titlePane.getChildren().addAll(showValueCheckBox, titleLabel, backValue, stepValue);
	valueVBox.getChildren().add(titlePane);
	if (!hide) {
		valueVBox.getChildren().add(contentPane);
	}

	valuesLines.getChildren().add(valueVBox);
	valueVBox.setUserData(dimension);
	titleLabel.minWidthProperty().bind(valueTitleWidth);
	titleLabel.widthProperty().addListener((v, o, n) -> {
		if (n.doubleValue() > valueTitleWidth.get()) {
			valueTitleWidth.set(n.doubleValue());
		}
	});
	if (titleLabel.widthProperty().doubleValue() > valueTitleWidth.get()) {
		valueTitleWidth.set(titleLabel.widthProperty().doubleValue());
	}

	return valueVBox;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:72,代码来源:MultidimensionalTimelineRenderer.java

示例5: zoomOutAndReset

import javafx.scene.Node; //导入方法依赖的package包/类
private static void zoomOutAndReset(Node node) {
    node.setScaleX(1);
    node.setScaleY(1);
    node.setTranslateX(0);
    node.setTranslateY(0);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:7,代码来源:StatsDisplay.java


注:本文中的javafx.scene.Node.setScaleY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。