當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseDownEvent.isShiftKeyDown方法代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.MouseDownEvent.isShiftKeyDown方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseDownEvent.isShiftKeyDown方法的具體用法?Java MouseDownEvent.isShiftKeyDown怎麽用?Java MouseDownEvent.isShiftKeyDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.event.dom.client.MouseDownEvent的用法示例。


在下文中一共展示了MouseDownEvent.isShiftKeyDown方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
	super.onMouseDown(event);
	if (event.isControlKeyDown() || event.isShiftKeyDown()) {
		// Trigger the dragging on the zoomToRectangleController:
		zoomToRectangleController.onMouseDown(event);
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt2,代碼行數:9,代碼來源:NavigationController.java

示例2: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent event) {
  ChartState chartInfo = getChartState(event);
  Chart chart = chartInfo.chart;
  int x = getLocalX(event);
  int y = getLocalY(event);

  if (y > (chart.getView().getHeight() - chart.getPlot().getOverviewAxisPanel().getBounds().height)) {
    int overviewX = (int)chart.getPlot().getBounds().x;
    Bounds highlightBounds = chart.getPlot().getOverviewAxisPanel().getHighlightBounds();
    if ( highlightBounds != null) {
      int hiliteX = (int) highlightBounds.x;
      System.out.println("   MOUSEDOWN    x:"+x+" overviewX:"+overviewX+" hiliteX:"+hiliteX);
      OverviewAxisMouseMoveHandler.setHiliteRelativeGrabX((double)((x - overviewX) - hiliteX));
    }
  }
  boolean handled;

  if (event.getNativeButton() == Event.BUTTON_RIGHT) {
    // Ignore mouse right-click -- let browser handle event.
    handled = false;
  } else {
    // Set the UI component that initiated the drag or select
    CompoundUIAction uiAction = chartInfo.getCompoundUIAction();
    uiAction.setSource(getComponent(x, y, chart.getPlot()));
    if (event.isShiftKeyDown()) {
      chart.setCursor(Cursor.SELECTING);
      uiAction.setSelectAction(true);
    } else {
      chart.setCursor(Cursor.DRAGGING);
      uiAction.setSelectAction(false);
    }
    uiAction.setStartX(x);
    if (uiAction.getSource() instanceof Overlay) {
    
      handled = true;
    } else {
      chart.setPlotFocus(x, y);
      handled = true;
    }
  }

  chartInfo.setHandled(handled);
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:44,代碼來源:ChartMouseDownHandler.java

示例3: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent e) {
//    public void mousePressed(MouseEvent e) {
    	e.preventDefault();
    	menuX = e.getX();
    	menuY = e.getY();
    	mouseDownTime = System.currentTimeMillis();
    	
    	// maybe someone did copy in another window?  should really do this when
    	// window receives focus
    	enablePaste();
    	
    	// IES - hack to only handle left button events in the web version.
    	if (e.getNativeButton() != NativeEvent.BUTTON_LEFT)
    		return;
    	
    	// set mouseElm in case we are on mobile
    	mouseSelect(e);
    	
    	mouseDragging=true;
    	didSwitch = false;
	
    	if (mouseWasOverSplitter) {
    		tempMouseMode = MODE_DRAG_SPLITTER;
    		return;
    	}
	if (e.getNativeButton() == NativeEvent.BUTTON_LEFT) {
//	    // left mouse
	    tempMouseMode = mouseMode;
	    if (e.isAltKeyDown() && e.isMetaKeyDown())
		tempMouseMode = MODE_DRAG_COLUMN;
	    else if (e.isAltKeyDown() && e.isShiftKeyDown())
		tempMouseMode = MODE_DRAG_ROW;
	    else if (e.isShiftKeyDown())
		tempMouseMode = MODE_SELECT;
	    else if (e.isAltKeyDown())
		tempMouseMode = MODE_DRAG_ALL;
	    else if (e.isControlKeyDown() || e.isMetaKeyDown())
		tempMouseMode = MODE_DRAG_POST;
	}

	int gx = inverseTransformX(e.getX());
	int gy = inverseTransformY(e.getY());
	if (doSwitch(gx, gy)) {
	    // do this BEFORE we change the mouse mode to MODE_DRAG_POST!  Or else logic inputs
	    // will add dots to the whole circuit when we click on them!
            didSwitch = true;
	    return;
	}
	
	// IES - Grab resize handles in select mode if they are far enough apart and you are on top of them
	if (tempMouseMode == MODE_SELECT && mouseElm!=null && 
			mouseElm.getHandleGrabbedClose(gx, gy, POSTGRABSQ, MINPOSTGRABSIZE) >=0 &&
		    !anySelectedButMouse() )
		tempMouseMode = MODE_DRAG_POST;


	
	if (tempMouseMode != MODE_SELECT && tempMouseMode != MODE_DRAG_SELECTED)
	    clearSelection();

	pushUndo();
	initDragGridX = gx;
	initDragGridY = gy;
	dragging = true;
	if (tempMouseMode !=MODE_ADD_ELM)
		return;
//	
	int x0 = snapGrid(gx);
	int y0 = snapGrid(gy);
	if (!circuitArea.contains(e.getX(), e.getY()))
	    return;

	dragElm = constructElement(mouseModeStr, x0, y0);
    }
 
開發者ID:sharpie7,項目名稱:circuitjs1,代碼行數:75,代碼來源:CirSim.java


注:本文中的com.google.gwt.event.dom.client.MouseDownEvent.isShiftKeyDown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。