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


Java MouseWheelEvent类代码示例

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


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

示例1: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
public void onMouseWheel(MouseWheelEvent event) {
  try {
    ChartState chartInfo = getChartState(event);
    Chart chart = chartInfo.chart;

    int wheelDir = event.getNativeEvent().getMouseWheelVelocityY();
    boolean isMouseWheelUp = (wheelDir <= 0);
    if (isMouseWheelUp) {
      chart.nextZoom();
    }
    else {
      chart.prevZoom();
    }
    
    chartInfo.setHandled(true);
    
  } catch (Exception e) {
    e.printStackTrace();
  }
  
  // Do not move scroll
  event.preventDefault();
}
 
开发者ID:codeaudit,项目名称:gwt-chronoscope,代码行数:24,代码来源:ChartMouseWheelHandler.java

示例2: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
public void onMouseWheel(MouseWheelEvent e) {
	e.preventDefault();
	
	// once we start zooming, don't allow other uses of mouse wheel for a while
	// so we don't accidentally edit a resistor value while zooming
	boolean zoomOnly = System.currentTimeMillis() < zoomTime+1000;
	
	if (!zoomOnly)
	    scrollValues(e.getNativeEvent().getClientX(), e.getNativeEvent().getClientY(), e.getDeltaY());
	
	if (mouseElm instanceof MouseWheelHandler && !zoomOnly)
		((MouseWheelHandler) mouseElm).onMouseWheel(e);
	else if (scopeSelected != -1)
	    scopes[scopeSelected].onMouseWheel(e);
	else if (!dialogIsShowing()) {
	    zoomCircuit(e.getDeltaY());
	    zoomTime = System.currentTimeMillis();
}
}
 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:20,代码来源:CirSim.java

示例3: onPaletteChooserMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@UiHandler("paletteChooser")
void onPaletteChooserMouseWheel(MouseWheelEvent event) {
	// determine new index based on scroll direction
	int newIndex = paletteChooser.getSelectedIndex();
	if (event.getDeltaY() < 0) {
		newIndex--;
	}
	else {
		newIndex++;
	}

	// set new index (if it's valid) and trigger change event (is not automatically triggered)
	if (newIndex >= 0 && newIndex < paletteChooser.getItemCount()) {
		paletteChooser.setSelectedIndex(newIndex);
		DomEvent.fireNativeEvent(Document.get().createChangeEvent(), paletteChooser);
	}
}
 
开发者ID:umlet,项目名称:umlet,代码行数:18,代码来源:MainView.java

示例4: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public void onMouseWheel(MouseWheelEvent event) {
	if(useTrackball){
		return;
	}
	double tzoom=0.05*baseScale;
	//TODO make class
	long t=System.currentTimeMillis();
	if(mouseLast+100>t){
		czoom*=2;
	}else{
		czoom=tzoom;
	}
	//GWT.log("wheel:"+event.getDeltaY());
	double tmp=cameraZ+event.getDeltaY()*czoom;
	tmp=Math.max(0.2, tmp);
	tmp=Math.min(4000, tmp);
	cameraZ=(double)tmp;
	mouseLast=t;
}
 
开发者ID:akjava,项目名称:GWTModelWeight,代码行数:21,代码来源:CopyOfGWTModelWeight.java

示例5: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public void onMouseWheel( MouseWheelEvent event )
{
	if( m_callback == null )
		return;

	event.preventDefault();

	int x = event.getRelativeX( m_canvas.getElement() );

	int delta = event.getDeltaY();
	if( delta > 0 )
		delta = 1;
	else if( delta < 0 )
		delta = -1;

	m_callback.onMouseWheel( m_cookie, event, x, delta );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:19,代码来源:LayeredAbsoluteStackPanel.java

示例6: VImageViewer

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
public VImageViewer() {
    /* Create widget's root panel */
    panelRoot = new FlowPanel();
    Style style = panelRoot.getElement().getStyle();
    style.setPosition(Position.RELATIVE);
    setStyleName(CLASSNAME);
    panelRoot.setStyleName(CLASSNAME + "-flow");
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);

    /* Create image container */
    imageContainer = new FlowPanel();
    style = imageContainer.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setOverflow(Overflow.HIDDEN);

    /* Add widgets */
    setWidget(panelRoot);
    panelRoot.add(imageContainer);

    /* Register handlers */
    addDomHandler(this, KeyDownEvent.getType());
    addDomHandler(this, ClickEvent.getType());
    addMouseWheelHandler(new MouseWheelHandler() {
        public void onMouseWheel(MouseWheelEvent event) {
            event.preventDefault();
            if (event.isNorth()) {
                moveImages(true);
            } else {
                moveImages(false);
            }
        }
    });
}
 
开发者ID:tepi,项目名称:ImageViewer,代码行数:35,代码来源:VImageViewer.java

示例7: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
void onMouseWheel(MouseWheelEvent e) {
wheelDeltaY += e.getDeltaY();
if (wheelDeltaY > 5) {
    slowDown();
    wheelDeltaY = 0;
}
if (wheelDeltaY < -5)
    speedUp();
    wheelDeltaY = 0;
   }
 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:11,代码来源:Scope.java

示例8: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public void onMouseWheel(MouseWheelEvent event) {
	if (event.isControlKeyDown()) {
		int delta = event.getDeltaY();
		app.getToolbar().zoomChangeClicked(Integer.signum(-delta));
		event.preventDefault();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:9,代码来源:SinglePageLayout.java

示例9: testSetupContextSwitcher

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Test
public void testSetupContextSwitcher() {

    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
    final MouseWheelHandler wheelHandler = mock(MouseWheelHandler.class);
    final MouseMoveHandler moveHandler = mock(MouseMoveHandler.class);

    doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();
    doReturn(wheelHandler).when(gridLienzoScrollHandler).disablePointerEvents();
    doReturn(moveHandler).when(gridLienzoScrollHandler).enablePointerEvents();

    gridLienzoScrollHandler.setupContextSwitcher();

    verify(domElementContainer).addDomHandler(wheelHandler, MouseWheelEvent.getType());
    verify(gridLienzoPanel).addMouseMoveHandler(moveHandler);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:GridLienzoScrollHandlerTest.java

示例10: setMouseWheelMoved

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
public void setMouseWheelMoved(JavaScriptObject aValue) {
	if (mouseWheelMoved != aValue) {
		if (mouseWheelReg != null) {
			mouseWheelReg.removeHandler();
			mouseWheelReg = null;
		}
		mouseWheelMoved = aValue;
		if (mouseWheelMoved != null) {
			MouseWheelHandler handler = new MouseWheelHandler() {
				@Override
				public void onMouseWheel(MouseWheelEvent event) {
					if (mouseWheelMoved != null) {
						event.stopPropagation();
						executeEvent(mouseWheelMoved, EventsPublisher.publish(event));
					}
				}
			};
			if (component instanceof Widget) {
				mouseWheelReg = ((Widget) component).addDomHandler(handler, MouseWheelEvent.getType());
			} else if (component instanceof HasMouseWheelHandlers) {
				mouseWheelReg = ((HasMouseWheelHandlers) component).addMouseWheelHandler(handler);
			}
		}
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:26,代码来源:EventsExecutor.java

示例11: addMouseWheelHandler

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
	return this.addDomHandler(handler, MouseWheelEvent.getType());
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:5,代码来源:ListItem.java

示例12: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
public void onMouseWheel(MouseWheelEvent event) {
	final boolean isNorth;
	if (event.getDeltaY() == 0) {
		isNorth = (getWheelDelta(event.getNativeEvent()) < 0);
	} else {
		isNorth = event.isNorth();
	}
	if (isNorth) {
		if (zoomType == ScrollZoomType.ZOOM_POSITION) {
			mapModel.getMapView().scale(
					2.0f,
					MapView.ZoomOption.LEVEL_CHANGE,
					mapModel.getMapView().getWorldViewTransformer()
							.viewToWorld(new Coordinate(event.getX(), event.getY())));
		} else {
			mapModel.getMapView().scale(2.0f, MapView.ZoomOption.LEVEL_CHANGE);
		}
	} else {
		if (zoomType == ScrollZoomType.ZOOM_POSITION) {
			mapModel.getMapView().scale(
					0.5f,
					MapView.ZoomOption.LEVEL_CHANGE,
					mapModel.getMapView().getWorldViewTransformer()
							.viewToWorld(new Coordinate(event.getX(), event.getY())));
		} else {
			mapModel.getMapView().scale(0.5f, MapView.ZoomOption.LEVEL_CHANGE);
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:30,代码来源:MapWidget.java

示例13: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public void onMouseWheel(MouseWheelEvent event) {
	final boolean isNorth;
	if (event.getDeltaY() == 0) {
		isNorth = (getWheelDelta(event.getNativeEvent()) < 0);
	} else {
		isNorth = event.isNorth();
	}
	Coordinate location = getLocation(event, RenderSpace.WORLD);
	scrollZoomTo(isNorth, location);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:12,代码来源:NavigationController.java

示例14: updateEventCaches

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
/**
 * Update event caches to keep track of the latest event of each instance.
 * @param the event to cache
 */
private void updateEventCaches(Event<?> event){
	if(event == null){
		return;
	}
	if(event instanceof DoubleClickEvent){
		doubleClickEvent = new org.gz.gwt.mousemanager.client.event.DoubleClickEvent((DoubleClickEvent)event, target);
	}
	if(event instanceof ClickEvent){
		clickEvent = new org.gz.gwt.mousemanager.client.event.ClickEvent((ClickEvent)event, target);
	}		
	if(event instanceof MouseUpEvent){
		mouseUpEvent = new org.gz.gwt.mousemanager.client.event.MouseUpEvent((MouseUpEvent)event, target);
	}
	if(event instanceof MouseDownEvent){
		mouseDownEvent = new org.gz.gwt.mousemanager.client.event.MouseDownEvent((MouseDownEvent)event, target);
	} 
	if(event instanceof MouseMoveEvent){
		mouseMoveEvent = new org.gz.gwt.mousemanager.client.event.MouseMoveEvent((MouseMoveEvent)event, target);
	}
	if(event instanceof MouseOverEvent){
		mouseOverEvent = new org.gz.gwt.mousemanager.client.event.MouseOverEvent((MouseOverEvent)event, target);
	}
	if(event instanceof MouseOutEvent){
		mouseOutEvent = new org.gz.gwt.mousemanager.client.event.MouseOutEvent((MouseOutEvent)event, target);
	}
	if(event instanceof MouseWheelEvent){
		mouseWheelEvent = new org.gz.gwt.mousemanager.client.event.MouseWheelEvent((MouseWheelEvent)event, target);
	}
	if(event instanceof ContextMenuEvent){
		contextMenuEvent = new org.gz.gwt.mousemanager.client.event.ContextMenuEvent();
	}
}
 
开发者ID:gzussa,项目名称:gwt-mousemanager,代码行数:37,代码来源:MouseHandlerManager.java

示例15: onMouseWheel

import com.google.gwt.event.dom.client.MouseWheelEvent; //导入依赖的package包/类
@Override
public void onMouseWheel(MouseWheelEvent event)
{
	int wheelDelta = event.getDeltaY();
	wheelDelta = wheelDelta != 0 ? wheelDelta : workaroundEventGetMouseWheelVelocityY(event.getNativeEvent());
	this.setMousePoint(event.getRelativeX(m_container.getElement()), event.getRelativeY(m_container.getElement()), m_mouseEvent.getPoint());
	m_mouseEvent.set(E_MouseEventType.MOUSE_SCROLLED, -wheelDelta, Element.as(event.getNativeEvent().getEventTarget()), false);
	
	s_logger.log(Level.INFO, "scroll" + m_mouseEvent.getScrollDelta());
	
	dispatchEvent(m_mouseEvent);
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:13,代码来源:Mouse.java


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