本文整理匯總了Java中com.google.gwt.event.dom.client.MouseDownEvent.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseDownEvent.getX方法的具體用法?Java MouseDownEvent.getX怎麽用?Java MouseDownEvent.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.event.dom.client.MouseDownEvent
的用法示例。
在下文中一共展示了MouseDownEvent.getX方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beginDragging
import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
private void beginDragging(MouseDownEvent event) {
if (DOM.getCaptureElement() == null) {
/*
* Need to check to make sure that we aren't already capturing an element
* otherwise events will not fire as expected. If this check isn't here,
* any class which extends custom button will not fire its click event for
* example.
*/
dragging = true;
DOM.setCapture(header.getElement());
if ("".equals(contentContainer.getElement().getStyle().getPosition())) {
contentContainer
.getElement()
.getStyle()
.setTop(contentContainer.getAbsoluteTop() + 1, Style.Unit.PX);
contentContainer
.getElement()
.getStyle()
.setLeft(contentContainer.getAbsoluteLeft(), Style.Unit.PX);
} else {
contentContainer
.getElement()
.getStyle()
.setTop(contentContainer.getAbsoluteTop(), Style.Unit.PX);
contentContainer
.getElement()
.getStyle()
.setLeft(contentContainer.getAbsoluteLeft(), Style.Unit.PX);
}
contentContainer.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
elemental.dom.Element element = (elemental.dom.Element) contentContainer.getElement();
transition = element.getStyle().getPropertyValue("transition");
element.getStyle().setProperty("transition", "all 0ms");
dragStartX = event.getX();
dragStartY = event.getY();
}
}
示例2: onMouseDown
import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
final int x = event.getX();
final int y = event.getY();
// System.out.println("onMouseDown(" + x + "," + y + ")");
if (lastStroke != null) {
System.out.println("error : 前のストローク情報が終わらないまま次のストロークが始まった");
}
lastStroke = new ArrayList<double[]>();
addPointToLastStroke(x, y);
// updateCanvas();
}
示例3: onMouseDown
import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
if (throughClick) {
return;
}
int x = event.getX();
int y = event.getY();
clickPosition = new Point(x, y);
if (canvas != null) {
circleMarkId = canvas.addPointerMark(x, y, circleMarkId);
canvas.update();
}
}
示例4: onMouseDown
import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent event) {
dragging = true;
startX = event.getX();
startY = event.getY();
// Stop the event from reaching the map controller: no panning while we're dragging the rectangle.
event.stopPropagation();
}
示例5: 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);
}
示例6: onMouseDown
import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
int button = event.getNativeButton();
if ((button == NativeEvent.BUTTON_LEFT || button == NativeEvent.BUTTON_MIDDLE) && touchId == null) {
isMouseDown = true;
x = event.getX();
y = event.getY();
event.preventDefault();
Event.setCapture(widget.getElement());
}
}