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


Java GestureEvent类代码示例

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


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

示例1: sendScrollEvent

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private void sendScrollEvent(EventType<ScrollEvent> fxEventType,
			final GestureEvent event,
			TKSceneListener sceneListener) {
		currentState.totalScrollX += event.xDirection;
		currentState.totalScrollY += event.yDirection;
		Point screenPosition = canvas.toDisplay(event.x, event.y);
//		System.out.println(fxEventType + " " + screenPosition);
		sceneListener.scrollEvent(fxEventType, 
				event.xDirection, event.yDirection, // scrollX, scrollY
				0, 0,        // totalScrollX, totalScrollY
				5.0, 5.0,  // xMultiplier, yMultiplier
				0,           // touchCount 
				0, 0,        // scrollTextX, scrollTextY
				0, 0,        // defaultTextX, defaultTextY
				event.x, event.y, // x, y
				screenPosition.x, screenPosition.y, // screenX, screenY
				isShift(event), isControl(event), isAlt(event), isMeta(event), 
				false,       // direct 
				false);      // inertia
	}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:21,代码来源:SwtToFXGestureConverter.java

示例2: sendZoomEvent

import org.eclipse.swt.events.GestureEvent; //导入依赖的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

示例3: sendRotateEvent

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private void sendRotateEvent(EventType<RotateEvent> fxEventType,
			final GestureEvent event,
			TKSceneListener sceneListener) {
		Point screenPosition = canvas.toDisplay(event.x, event.y);
		double rotation = (fxEventType == RotateEvent.ROTATION_FINISHED) 
				? currentState.lastRotation
				: -event.rotation;
//		System.out.println(fxEventType + " " + rotation);
		sceneListener.rotateEvent(fxEventType,
				rotation - currentState.lastRotation, // rotation
				rotation,               // totalRotation
				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.lastRotation = rotation;
	}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:19,代码来源:SwtToFXGestureConverter.java

示例4: sendSwipeEvent

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private void sendSwipeEvent(final GestureEvent event,
				TKSceneListener sceneListener) {
		Point screenPosition = canvas.toDisplay(event.x, event.y);
		EventType<SwipeEvent> fxEventType = null;
		if(event.yDirection > 0)
			fxEventType = SwipeEvent.SWIPE_DOWN;
		else if(event.yDirection < 0) 
			fxEventType = SwipeEvent.SWIPE_UP;
		else if(event.xDirection > 0)
			fxEventType = SwipeEvent.SWIPE_RIGHT;
		else if(event.xDirection < 0) 
			fxEventType = SwipeEvent.SWIPE_LEFT;
//		System.out.println(fxEventType.toString());
		sceneListener.swipeEvent(fxEventType,
				0,                  // touch
				event.x, event.y,   // x, y
				screenPosition.x, screenPosition.y, // screenX, screenY
				isShift(event), isControl(event), isAlt(event), isMeta(event), 
				false);             // direct 
	}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:21,代码来源:SwtToFXGestureConverter.java

示例5: GraphViewerZoomable

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
GraphViewerZoomable(Composite composite, int style) {
	super(composite, style);
	getZoomManager().setZoom(1.0);
	Graph graph = getGraphControl();
	graph.setScrollBarVisibility(FigureCanvas.ALWAYS);
	graph.setTouchEnabled(false);
	graph.addGestureListener(new GestureListener() {
		public void gesture(GestureEvent e) {
			if(e.detail == SWT.GESTURE_MAGNIFY)
				zoom(e.magnification);
		}
	});
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:14,代码来源:GraphViewerZoomable.java

示例6: mouseScrolled

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
@Override
public void mouseScrolled(final MouseEvent e) {
	Platform.runLater(new Runnable() {
           @Override
           public void run() {
           	final Object scenePeer = getPrivateField(canvas, "scenePeer");
               AccessController.doPrivileged(new PrivilegedAction<Void>() {
                   @Override
                   public Void run() {
                   	TKSceneListener sceneListener = getPrivateField(scenePeer, "sceneListener");
					if (sceneListener == null) {
                           return null;
                       }
					Event mockEvent = new Event();
					mockEvent.stateMask = e.stateMask;
					mockEvent.x = e.x;
					mockEvent.y = e.y;
					mockEvent.xDirection = 0;
					mockEvent.yDirection = e.count;
					mockEvent.widget = e.widget;
					mockEvent.display = e.display;
					mockEvent.time = e.time;
					mockEvent.data = e.data;
					GestureEvent mockGestureEvent = new GestureEvent(mockEvent);
					mockGestureEvent.stateMask = e.stateMask;
					sendScrollEvent(ScrollEvent.SCROLL_STARTED, mockGestureEvent, sceneListener);
					sendScrollEvent(ScrollEvent.SCROLL_FINISHED, mockGestureEvent, sceneListener);
                       return null;
                   }

               }, (AccessControlContext) getPrivateField(scenePeer, "accessCtrlCtx"));
           }
       });
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:35,代码来源:SwtToFXGestureConverter.java

示例7: sendGestureEventToFX

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
protected void sendGestureEventToFX(final GestureEvent event) {
       Platform.runLater(new Runnable() {
           @Override
           public void run() {
           	final Object scenePeer = getPrivateField(canvas, "scenePeer");
               AccessController.doPrivileged(new PrivilegedAction<Void>() {
                   @Override
                   public Void run() {
                   	TKSceneListener sceneListener = getPrivateField(scenePeer, "sceneListener");
					if (sceneListener == null) {
                           return null;
                       }
					switch(event.detail) {
						case SWT.GESTURE_BEGIN:
							break;
						case SWT.GESTURE_END:
							changeState(StateType.IDLE, event, sceneListener);
							break;
						case SWT.GESTURE_MAGNIFY:
							changeState(StateType.ZOOMING, event, sceneListener);
							break;
						case SWT.GESTURE_PAN:
							changeState(StateType.SCROLLING, event, sceneListener);
							break;
						case SWT.GESTURE_ROTATE:
							changeState(StateType.ROTATING, event, sceneListener);
							break;
						case SWT.GESTURE_SWIPE:
							changeState(StateType.IDLE, event, sceneListener);
					}
                       return null;
                   }

               }, (AccessControlContext) getPrivateField(scenePeer, "accessCtrlCtx"));
           }
       });
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:38,代码来源:SwtToFXGestureConverter.java

示例8: gesture

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
@Override
public void gesture(GestureEvent event) {
	sendGestureEventToFX(event);
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:5,代码来源:SwtToFXGestureConverter.java

示例9: changeState

import org.eclipse.swt.events.GestureEvent; //导入依赖的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

示例10: isShift

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private boolean isShift(final GestureEvent event) {
	return (event.stateMask & SWT.SHIFT) != 0;
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:4,代码来源:SwtToFXGestureConverter.java

示例11: isControl

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private boolean isControl(final GestureEvent event) {
	return (event.stateMask & SWT.CONTROL) != 0;
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:4,代码来源:SwtToFXGestureConverter.java

示例12: isAlt

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private boolean isAlt(final GestureEvent event) {
	return (event.stateMask & SWT.ALT) != 0;
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:4,代码来源:SwtToFXGestureConverter.java

示例13: isMeta

import org.eclipse.swt.events.GestureEvent; //导入依赖的package包/类
private boolean isMeta(final GestureEvent event) {
	return (event.stateMask & SWT.COMMAND) != 0;
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:4,代码来源:SwtToFXGestureConverter.java


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