• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HumanInputEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: humanStart

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanStart(HumanInputEvent ev) {
    int x= getAbsoluteX(ev);
    int y= getAbsoluteY(ev);
    PopupRegion r= findRegion(x,y);

    addPreventEvent();
    if (r== PopupRegion.TITLE_BAR) {
        if (_hideOnResizeWidget!=null) {
            GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "hidden");
        }
        ev.preventDefault();
        beginMove(x,y);

    } else if (_expandW!=null) {
        if (r== PopupRegion.SE_CORNER || r== PopupRegion.SW_CORNER) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "hidden");
            }
            ev.preventDefault();
            beginResize(r);
        }
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:24,代码来源:PopupPane.java


示例2: humanStop

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanStop(HumanInputEvent ev) {
        removePreventEvent();
        if (_moving) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "visible");
            }
            ev.preventDefault();
//            DOM.eventPreventDefault(ev);
            endMove();

        }
        else if (_resizing) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "visible");
            }
            ev.preventDefault();
//            DOM.eventPreventDefault(ev);
            endResize();
        }
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:21,代码来源:PopupPane.java


示例3: handleMove

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private static void handleMove(final EventHandlingTarget panel, final DragCache storage, HumanInputEvent<?> event) {
	// Notification.showInfo("MOVE " + getPointAbsolute(event));
	if (storage.activePanel != null && DRAG_COMMANDS.contains(storage.dragging)) {
		Point p = getPoint(storage.activePanel, event);
		int diffX = p.x - storage.moveStart.getX();
		int diffY = p.y - storage.moveStart.getY();
		diffX -= diffX % SharedConstants.DEFAULT_GRID_SIZE;
		diffY -= diffY % SharedConstants.DEFAULT_GRID_SIZE;
		if (diffX != 0 || diffY != 0) {
			panel.onMouseMoveDraggingScheduleDeferred(storage.moveStart, diffX, diffY, storage.elementToDrag, event.isShiftKeyDown(), event.isControlKeyDown(), storage.dragging == DragStatus.FIRST);
			storage.dragging = DragStatus.CONTINUOUS; // after FIRST real drag switch to CONTINUOUS
			storage.moveStart = storage.moveStart.copy().move(diffX, diffY); // make copy because otherwise deferred action will act on wrong position
		}
	}
	else if (storage.mouseContainingPanel != null) {
		storage.mouseContainingPanel.onMouseMove(getPoint(storage.mouseContainingPanel, event));
	}
}
 
开发者ID:umlet,项目名称:umlet,代码行数:19,代码来源:EventHandlingUtils.java


示例4: getLocation

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public Coordinate getLocation(HumanInputEvent<?> event, RenderSpace renderSpace) {
	switch (renderSpace) {
		case WORLD:
			Coordinate screen = getLocation(event, RenderSpace.SCREEN);
			return mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(screen);
		case SCREEN:
		default:
			if (event instanceof MouseEvent<?>) {
				Element element = mapWidget.getDOM();
				double offsetX = ((MouseEvent<?>) event).getRelativeX(element);
				double offsetY = ((MouseEvent<?>) event).getRelativeY(element);
				return new Coordinate(offsetX, offsetY);
			} else if (event instanceof TouchEvent<?>) {
				Touch touch = ((TouchEvent<?>) event).getTouches().get(0);
				return new Coordinate(touch.getClientX(), touch.getClientY());
			}
			return new Coordinate(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:21,代码来源:AbstractGraphicsController.java


示例5: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
/**
 * Start dragging, register base for selection rectangle.
 * 
 * @param event
 *            event
 */
@Override
public void onDown(HumanInputEvent<?> event) {
	if (dragging && leftWidget) {
		// mouse was moved outside of widget
		doSelect(event);

	} else if (!isRightMouseButton(event)) {
		// no point trying to select when there is no active layer
		dragging = true;
		leftWidget = false;
		timestamp = new Date().getTime();
		begin = getLocation(event, RenderSpace.SCREEN);
		bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
		shift = event.isShiftKeyDown();
		rectangle = new Rectangle("selectionRectangle");
		rectangle.setStyle(rectangleStyle);
		rectangle.setBounds(bounds);
		mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:27,代码来源:AbstractRectangleController.java


示例6: updateRectangle

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void updateRectangle(HumanInputEvent<?> event) {
	Coordinate pos = getLocation(event, RenderSpace.SCREEN);
	double x = begin.getX();
	double y = begin.getY();
	double width = pos.getX() - x;
	double height = pos.getY() - y;
	if (width < 0) {
		x = pos.getX();
		width = -width;
	}
	if (height < 0) {
		y = pos.getY();
		height = -height;
	}
	bounds.setX(x);
	bounds.setY(y);
	bounds.setWidth(width);
	bounds.setHeight(height);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:20,代码来源:AbstractRectangleController.java


示例7: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onDown(HumanInputEvent<?> event) {
	SliderArea sliderArea = zoomSlider.getSliderArea();
	event.stopPropagation();
	double y = getLocation(event, RenderSpace.SCREEN).getY();
	double x = getLocation(event, RenderSpace.SCREEN).getX();
	Bbox sliderAreaBounds = sliderArea.getAddonBounds();
	Coordinate origin = sliderAreaBounds.getOrigin();
	Coordinate endPoint = sliderAreaBounds.getEndPoint();
	if (origin.getX() < x && endPoint.getX() > x &&
		origin.getY() < y && endPoint.getY() > y) {
		dragging = true;
		sliderArea.drawMapRectangle();
	}
	event.preventDefault();
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:17,代码来源:ZoomSliderController.java


示例8: onDraggerMouseUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void onDraggerMouseUp(HumanInputEvent event, double relativeY)
{
	if( m_isMouseDown )
	{
		Event.releaseCapture(Magnifier.this.m_dragger.getElement());
		event.preventDefault();
		
		//--- DRK > Pretty hacky, but I can't figure out how to "forward" the event up the DOM so tooltip can get it.
		if( event instanceof MouseUpEvent )
		{
			m_viewContext.toolTipMngr.onMouseUp((MouseUpEvent)event);
		}
		
		double mouseY = relativeY;
		Magnifier.this.setDraggerPositionFromMouse(mouseY + m_mouseDownOffset);
		
		m_isMouseDown = false;
	}
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:20,代码来源:Magnifier.java


示例9: onUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
public void onUp(HumanInputEvent<?> event) {
	// Only insert when service is in the correct state:
	if (service.getEditingState() == GeometryEditState.INSERTING) {
		try {
			if (isDoubleClick(event)) {
				stopInserting();					
			} else {
				// Insert the location at the given index:
				GeometryIndex insertIndex = service.getInsertIndex();
				Coordinate location = getSnappedLocationWithinMaxBounds(event);
				service.insert(Collections.singletonList(insertIndex),
						Collections.singletonList(Collections.singletonList(location)));

				String geometryType = service.getGeometry().getGeometryType();
				if (geometryType.equals(Geometry.POINT) || geometryType.equals(Geometry.MULTI_POINT)) {
					stopInserting();
				}
			}
		} catch (GeometryOperationFailedException e) {
			logger.log(Level.WARNING, "Operation failed", e);
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:24,代码来源:GeometryIndexInsertController.java


示例10: isDoubleClick

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private boolean isDoubleClick(HumanInputEvent<?> event) {
	Coordinate clickPosition = getLocation(event, RenderSpace.SCREEN);
	boolean doubleClicked = false;
	if (lastClickedPosition != null) {
		int distance = (int) Math.hypot(clickPosition.getX() - lastClickedPosition.getX(), clickPosition.getY()
				- lastClickedPosition.getY());
		if (distance < MIN_DOUBLECLICK_DISTANCE) {
			doubleClicked = true;
		} 
	} 
	if (doubleClicked) {
		lastClickedPosition = null;
		return true;
	} else {
		lastClickedPosition = clickPosition;
		return false;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:19,代码来源:GeometryIndexInsertController.java


示例11: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
public void onDown(HumanInputEvent<?> event) {
	if (service.getEditingState() == GeometryEditState.IDLE) {
		if (event.isShiftKeyDown()) {
			// Add to or remove from selection:
			if (service.getIndexStateService().isSelected(index)) {
				service.getIndexStateService().deselect(Collections.singletonList(index));
				event.stopPropagation();
			} else {
				service.getIndexStateService().select(Collections.singletonList(index));
			}
		} else {
			// Deselect all and select only this index:
			service.getIndexStateService().deselectAll();
			service.getIndexStateService().select(Collections.singletonList(index));				
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:18,代码来源:GeometryIndexSelectHandler.java


示例12: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onDown(HumanInputEvent<?> event) {
	if (!isRightMouseButton(event)) {
		dragging = true;
		begin = getLocation(event, RenderSpace.SCREEN);
		shift = event.isShiftKeyDown();
		
		circle = new Circle((int) begin.getX(), (int) begin.getY(), 0);
		circle.setFillColor(fillColor);
		circle.setFillOpacity(fillOpacity);
		circle.setStrokeColor(strokeColor);
		circle.setStrokeWidth(strokeWidth);
		getContainer().add(circle);
		
		line = new Line((int) begin.getX(), (int) begin.getY(), (int) begin.getX(), (int) begin.getY());
		line.setStrokeColor(strokeColor);
		line.setStrokeWidth(strokeWidth);
		getContainer().add(line);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:21,代码来源:AbstractCircleController.java


示例13: onUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onUp(HumanInputEvent<?> event) {
	// Assure dragging or clicking started inside this widget
	if (dragging) {
		shift |= event.isShiftKeyDown(); // shift is used when depressed either at beginning or end
		updateCircle(event);
		
		Geometry geometry = new Geometry(Geometry.POINT, 0, -1);
		Coordinate[] coordinates = new Coordinate[]{new Coordinate(circle.getUserX(), circle.getUserY())};
		geometry.setCoordinates(coordinates);

		ViewPort viewPort = mapPresenter.getViewPort();
		execute(viewPort.getTransformationService().transform(geometry, RenderSpace.SCREEN, RenderSpace.WORLD), 
				circle.getRadius() * viewPort.getResolution());

		stopDragging();
		dragging = false;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:20,代码来源:AbstractCircleController.java


示例14: updateCircle

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void updateCircle(HumanInputEvent<?> event) {
	Coordinate pos = getLocation(event, RenderSpace.SCREEN);
	double x = begin.getX();
	double y = begin.getY();
	double currentX = pos.getX();
	double currentY = pos.getY();
	
	double deltaX = currentX - x;
	double deltaY = currentY - y;
	radius = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
	
	circle.setRadius((int) radius);
	
	line.setUserX2(currentX);
	line.setUserY2(currentY);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:17,代码来源:AbstractCircleController.java


示例15: humanMove

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanMove(HumanInputEvent ev) {
        int x= getAbsoluteX(ev);
        int y= getAbsoluteY(ev);
        if (_moving) {
//            DOM.eventPreventDefault(ev.getNativeEvent());
            ev.preventDefault();
            doMove(x,y);
        }
        else if (_resizing) {
//            DOM.eventPreventDefault(ev);
            ev.preventDefault();
            moveResize(x,y);
        }
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:15,代码来源:PopupPane.java


示例16: getAbsoluteX

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private int getAbsoluteX(HumanInputEvent ev) {
    if (ev instanceof MouseEvent) {
        return  ((MouseEvent)ev).getClientX()+Window.getScrollLeft();
    }
    if (ev instanceof TouchEvent) {
        JsArray<Touch> tAry= ((TouchEvent)ev).getTargetTouches();
        return  tAry.get(0).getClientX()+Window.getScrollLeft();
    }
    return 0;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:11,代码来源:PopupPane.java


示例17: getAbsoluteY

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private int getAbsoluteY(HumanInputEvent ev) {
    if (ev instanceof MouseEvent) {
        return  ((MouseEvent)ev).getClientY()+ Window.getScrollTop();
    }
    if (ev instanceof TouchEvent) {
        JsArray<Touch> tAry= ((TouchEvent)ev).getTargetTouches();
        return tAry.get(0).getClientY() + Window.getScrollTop();
    }
    return 0;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:11,代码来源:PopupPane.java


示例18: handleEnd

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private static void handleEnd(EventHandlingTarget panel, final DragCache storage, HumanInputEvent<?> event) {
	// Notification.showInfo("UP");
	if (DRAG_COMMANDS.contains(storage.dragging)) {
		panel.onMouseDragEnd(storage.elementToDrag, getPoint(storage.activePanel, event));
	}
	storage.dragging = DragStatus.NO;
}
 
开发者ID:umlet,项目名称:umlet,代码行数:8,代码来源:EventHandlingUtils.java


示例19: handleStart

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private static void handleStart(EventHandlingTarget[] panels, final DragCache storage, FocusPanel handlerTarget, HumanInputEvent<?> event, Point p) {
	// Notification.showInfo("DOWN " + p.x);
	handlerTarget.setFocus(true);

	event.preventDefault(); // necessary to avoid showing textcursor and selecting proppanel in chrome AND to avoid scrolling with touch move (problem is it also avoids scrolling with 2 fingers)
	storage.moveStart = new Point(p.x, p.y);
	storage.dragging = DragStatus.FIRST;
	storage.elementToDrag = storage.activePanel.getGridElementOnPosition(storage.moveStart);
	storage.activePanel.onMouseDownScheduleDeferred(storage.elementToDrag, event.isControlKeyDown());
}
 
开发者ID:umlet,项目名称:umlet,代码行数:11,代码来源:EventHandlingUtils.java


示例20: getPoint

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private static Point getPoint(EventHandlingTarget drawPanelCanvas, HumanInputEvent<?> event) {
	Element e = drawPanelCanvas.getElement();
	if (event instanceof MouseEvent<?>) {
		return new Point(((MouseEvent<?>) event).getRelativeX(e), ((MouseEvent<?>) event).getRelativeY(e));
	}
	else if (event instanceof TouchEndEvent) {
		return new Point(((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeY(e));
	}
	else if (event instanceof TouchEvent<?>) {
		return new Point(((TouchEvent<?>) event).getTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getTouches().get(0).getRelativeY(e));
	}
	else {
		throw new RuntimeException("Unknown Event Type: " + event);
	}
}
 
开发者ID:umlet,项目名称:umlet,代码行数:16,代码来源:EventHandlingUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueShape类代码示例发布时间:2022-05-22
下一篇:
Java ExternalContext类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap