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


Java ZoomEvent类代码示例

本文整理汇总了Java中javafx.scene.input.ZoomEvent的典型用法代码示例。如果您正苦于以下问题:Java ZoomEvent类的具体用法?Java ZoomEvent怎么用?Java ZoomEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sendZoomEvent

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
private void sendZoomEvent(EventType<ZoomEvent> fxEventType,
			final GestureEvent event,
			TKSceneListener sceneListener) {
		Point screenPosition = canvas.toDisplay(event.x, event.y);
		double magnification = (fxEventType == ZoomEvent.ZOOM_FINISHED) 
				? currentState.lastZoomFactor
				: event.magnification;
//		System.out.println(fxEventType + " " + magnification);
		sceneListener.zoomEvent(fxEventType,
				magnification / currentState.lastZoomFactor, // zoom factor
				magnification,    // totalZoomFactor
				event.x, event.y,       // x, y
				screenPosition.x, screenPosition.y,           // screenX, screenY
				isShift(event), isControl(event), isAlt(event), isMeta(event), 
				false,      // direct 
				false);     // inertia
		currentState.lastZoomFactor = magnification;
	}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:19,代码来源:SwtToFXGestureConverter.java

示例2: testScaleByTouch

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
@Test
public void testScaleByTouch() throws Exception {
	double factor = 4.2;
	pane.fireEvent(new ZoomEvent(ZoomEvent.ZOOM, 0, 0, 0, 0, false, false, false, false,
			                            false, false, factor, factor, null));
	assertThat(pane.getCurrentXScale()).isEqualTo(factor);
}
 
开发者ID:tom91136,项目名称:GestureFX,代码行数:8,代码来源:GesturePaneTest.java

示例3: addListeners

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
private void addListeners() {
    imageView.addEventHandler(MouseEvent.MOUSE_PRESSED, pressedHandler);
    imageView.addEventHandler(MouseEvent.MOUSE_DRAGGED, draggedHandler);
    imageView.addEventHandler(MouseEvent.MOUSE_RELEASED, releasedHandler);
    
    if (Platform.isDesktop()) {
        imageView.addEventHandler(ScrollEvent.ANY, scrollHandler);
    } else {
        imageView.addEventHandler(ZoomEvent.ZOOM_STARTED, zoomStartedHandler);
        imageView.addEventHandler(ZoomEvent.ZOOM_FINISHED, zoomFinishedHandler);
        imageView.addEventHandler(ZoomEvent.ZOOM, zoomHandler);
    }
    imageView.addEventHandler(MouseEvent.MOUSE_CLICKED, clickedHandler);
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:15,代码来源:ExhibitionMapPresenter.java

示例4: removeListeners

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
private void removeListeners() {
    imageView.removeEventHandler(MouseEvent.MOUSE_PRESSED, pressedHandler);
    imageView.removeEventHandler(MouseEvent.MOUSE_DRAGGED, draggedHandler);
    imageView.removeEventHandler(MouseEvent.MOUSE_RELEASED, releasedHandler);
    if (Platform.isDesktop()) {
        imageView.removeEventHandler(ScrollEvent.ANY, scrollHandler);
    } else {
        imageView.removeEventHandler(ZoomEvent.ZOOM_STARTED, zoomStartedHandler);
        imageView.removeEventHandler(ZoomEvent.ZOOM_FINISHED, zoomFinishedHandler);
        imageView.removeEventHandler(ZoomEvent.ZOOM, zoomHandler);
    }
    imageView.removeEventHandler(MouseEvent.MOUSE_CLICKED, clickedHandler);
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:14,代码来源:ExhibitionMapPresenter.java

示例5: scrollPaneOnZoom

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
@FXML
void scrollPaneOnZoom(ZoomEvent event) {
    FOKLogger.fine(MainWindow.class.getName(), "Zooming in view, new Zoom level: " + event.getZoomFactor());
    drawing.setScaleX(drawing.getScaleX() * event.getZoomFactor());
    drawing.setScaleY(drawing.getScaleY() * event.getZoomFactor());
    // TODO: Update the actual size in the scrollpane (so that scrollbars appear when zooming in
    // TODO: Add Keyboard and touchpad zoom
    // TODO: do the zoom with the right zoom center
}
 
开发者ID:vatbub,项目名称:zorkClone,代码行数:10,代码来源:EditorView.java

示例6: onZoom

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
/**
 * On zoom event.
 *
 * @param e The zoom event.
 */
@FXML
private void onZoom(final ZoomEvent e) {
  this.chart.zoom(
    e.getZoomFactor(),
    this.initialMouseScrollX,
    this.initialMouseScrollY
  );
}
 
开发者ID:kasperisager,项目名称:kelvin-maps,代码行数:14,代码来源:ChartController.java

示例7: compositeTokenPane_OnZoom

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
@FXML
void compositeTokenPane_OnZoom(ZoomEvent event) {
	Double scale = portraitImageView.getScaleY() * event.getZoomFactor();

	portraitImageView.setScaleX(scale);
	portraitImageView.setScaleY(scale);
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:8,代码来源:TokenTool_Controller.java

示例8: initialize

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
public static void initialize(ViewPort view, InputHandler input, RenderHandler render, Stage primaryStage) throws Exception
{
	final ResizeableLayeredCanvasPane canvasPane = new ResizeableLayeredCanvasPane(
			render.getNumOfLayers(), 640, 480);

	canvasPane.setFocusTraversable(true);
	canvasPane.addEventHandler(MouseEvent.MOUSE_MOVED, event ->
			view.setCursorPosition(event.getX(), event.getY()));
	canvasPane.addEventHandler(MouseEvent.MOUSE_DRAGGED, event ->
			view.setCursorPosition(event.getX(), event.getY()));
	canvasPane.addEventHandler(MouseEvent.MOUSE_PRESSED, event ->
			view.setCursorDown(true));
	canvasPane.addEventHandler(MouseEvent.MOUSE_RELEASED, event ->
			view.setCursorDown(false));
	canvasPane.addEventHandler(ScrollEvent.SCROLL, event ->
			view.move(event.getDeltaX(), event.getDeltaY()));
	canvasPane.addEventHandler(ZoomEvent.ZOOM, event ->
			view.zoom(event.getZoomFactor()));
	canvasPane.addEventFilter(KeyEvent.KEY_PRESSED, event ->
			input.onInput(event.getCode()));

	final BorderPane root = new BorderPane(canvasPane);
	final AnimationTimer timer = new AnimationTimer()
	{
		@Override
		public void handle(long now)
		{
			render.onDraw(primaryStage, canvasPane, view);
		}
	};

	Scene scene = new Scene(root);
	scene.setFill(Color.WHITE);
	primaryStage.setScene(scene);
	primaryStage.setTitle("Application");
	primaryStage.show();

	render.onLoad(primaryStage, canvasPane, view);

	timer.start();
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:42,代码来源:Baron.java

示例9: zoom

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
public static void zoom(Node node, ZoomEvent event) {
    zoom(node, event.getZoomFactor(), event.getSceneX(), event.getSceneY());
}
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:4,代码来源:FxUtils.java

示例10: zooming

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
public void zooming(ZoomEvent ze) {
    zoom(ze.getTotalZoomFactor(), ze.getX(), ze.getY());
}
 
开发者ID:shemnon,项目名称:FollowTheBitcoin,代码行数:4,代码来源:ZoomPane.java

示例11: changeState

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
protected boolean changeState(StateType newStateType, GestureEvent event, TKSceneListener sceneListener) {
	if(newStateType != currentState.type) { 
		switch (currentState.type) {
			case SCROLLING:
				sendScrollEvent(ScrollEvent.SCROLL_FINISHED, event, sceneListener);
				break;
			case ROTATING:
				sendRotateEvent(RotateEvent.ROTATION_FINISHED, event, sceneListener);
				break;
			case ZOOMING:
				sendZoomEvent(ZoomEvent.ZOOM_FINISHED, event, sceneListener);
				break;
			default:
				// do nothing
		}
		switch (newStateType) {
			case SCROLLING:
				sendScrollEvent(ScrollEvent.SCROLL_STARTED, event, sceneListener);
				break;
			case ROTATING:
				sendRotateEvent(RotateEvent.ROTATION_STARTED, event, sceneListener);
				break;
			case ZOOMING:
				sendZoomEvent(ZoomEvent.ZOOM_STARTED, event, sceneListener);
				break;
			case IDLE:
				if(event.detail == SWT.GESTURE_SWIPE)
					sendSwipeEvent(event, sceneListener);
				break;
			default:
				// do nothing
		}
		currentState = new State(newStateType);
		return true;
	}
	switch (newStateType) {
		case SCROLLING:
			sendScrollEvent(ScrollEvent.SCROLL, event, sceneListener);
			break;
		case ROTATING:
			sendRotateEvent(RotateEvent.ROTATE, event, sceneListener);
			break;
		case ZOOMING:
			sendZoomEvent(ZoomEvent.ZOOM, event, sceneListener);
			break;
		case IDLE:
			if(event.detail == SWT.GESTURE_SWIPE)
				sendSwipeEvent(event, sceneListener);
		default:
			// do nothing
	}
	return false;
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:54,代码来源:SwtToFXGestureConverter.java

示例12: handleZoomEvent

import javafx.scene.input.ZoomEvent; //导入依赖的package包/类
/**
 * Handle a zoom event.
 *
 * @param event
 *            The zoom event.
 */
private void handleZoomEvent(final ZoomEvent event) {
	if (!Double.isNaN(event.getZoomFactor())) {
		zoomImage(event.getZoomFactor());
	}
}
 
开发者ID:jeisfeld,项目名称:Augendiagnose,代码行数:12,代码来源:SizableImageView.java


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