本文整理了Java中com.google.gwt.event.dom.client.MouseEvent.getRelativeX()
方法的一些代码示例,展示了MouseEvent.getRelativeX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.getRelativeX()
方法的具体详情如下:
包路径:com.google.gwt.event.dom.client.MouseEvent
类名称:MouseEvent
方法名:getRelativeX
[英]Gets the mouse x-position relative to a given element.
[中]获取鼠标相对于给定元素的x位置。
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the mouse x-position relative to the event's current target element.
*
* @return the relative x-position
*/
public int getX() {
Element relativeElem = getRelativeElement();
if (relativeElem != null) {
return getRelativeX(relativeElem);
}
return getClientX();
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the mouse x-position relative to the event's current target element.
*
* @return the relative x-position
*/
public int getX() {
Element relativeElem = getRelativeElement();
if (relativeElem != null) {
return getRelativeX(relativeElem);
}
return getClientX();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Gets the mouse x-position relative to the event's current target element.
*
* @return the relative x-position
*/
public int getX() {
Element relativeElem = getRelativeElement();
if (relativeElem != null) {
return getRelativeX(relativeElem);
}
return getClientX();
}
代码示例来源:origin: ahome-it/lienzo-core
protected AbstractNodeMouseEvent(final T event)
{
super(event);
m_x = event.getRelativeX(event.getRelativeElement());
m_y = event.getRelativeY(event.getRelativeElement());
}
代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core
protected AbstractNodeMouseEvent(final T event)
{
super(event);
m_x = event.getRelativeX(event.getRelativeElement());
m_y = event.getRelativeY(event.getRelativeElement());
}
代码示例来源:origin: com.ahome-it/lienzo-core
protected AbstractNodeMouseEvent(final T event)
{
super(event);
m_x = event.getRelativeX(event.getRelativeElement());
m_y = event.getRelativeY(event.getRelativeElement());
}
代码示例来源:origin: com.rht-emitrom/lienzo-core
protected AbstractNodeMouseEvent(T event)
{
m_x = event.getRelativeX(event.getRelativeElement());
m_y = event.getRelativeY(event.getRelativeElement());
m_event = event;
}
代码示例来源:origin: ahome-it/lienzo-core
protected AbstractNodeMouseEvent(final T event)
{
super(event);
m_x = event.getRelativeX(event.getRelativeElement());
m_y = event.getRelativeY(event.getRelativeElement());
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-graphicsediting-example-jar
@Override
public Coordinate getScreenCoordinate(MouseEvent<?> event) {
Element screenElement = mapPresenter.asWidget().getElement();
return new Coordinate(event.getRelativeX(screenElement), event.getRelativeY(screenElement));
}
代码示例来源:origin: fjfd/microscope
end_x = event.getRelativeX(image);
end_y = event.getRelativeY(image);
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
@Override
public Coordinate getLocation(HumanInputEvent<?> event, RenderSpace renderSpace) {
switch (renderSpace) {
case WORLD:
Coordinate screen = getLocation(event, RenderSpace.SCREEN);
return mapPresenter.getViewPort().transform(screen, RenderSpace.SCREEN, RenderSpace.WORLD);
case SCREEN:
default:
if (event instanceof MouseEvent<?>) {
Element element = mapPresenter.asWidget().getElement();
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());
}
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private void updateRectangle(MouseEvent<?> event) {
int beginX = x;
int beginY = y;
int endX = event.getRelativeX(mapPresenter.asWidget().getElement());
int endY = event.getRelativeY(mapPresenter.asWidget().getElement());
// Check if begin and end need to be reversed:
if (beginX > endX) {
int temp = endX;
endX = beginX;
beginX = temp;
}
if (beginY > endY) {
int temp = endY;
endY = beginY;
beginY = temp;
}
int width = endX - beginX;
int height = endY - beginY;
if (height != 0 && width != 0) {
zoomInRect.setStep(5, new MoveTo(false, beginX, beginY));
zoomInRect.setStep(6, new LineTo(false, endX, beginY));
zoomInRect.setStep(7, new LineTo(false, endX, endY));
zoomInRect.setStep(8, new LineTo(false, beginX, endY));
zoomInRect.setStep(9, new ClosePath());
screenBounds = new Bbox(beginX, beginY, width, height);
}
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
@Override
public Coordinate getLocation(HumanInputEvent<?> event, RenderSpace renderSpace) {
switch (renderSpace) {
case WORLD:
Coordinate screen = getLocation(event, RenderSpace.SCREEN);
return mapPresenter.getViewPort().getTransformationService()
.transform(screen, RenderSpace.SCREEN, RenderSpace.WORLD);
case SCREEN:
default:
Element element = mapPresenter.asWidget().getElement();
if (event instanceof MouseEvent<?>) {
double offsetX = ((MouseEvent<?>) event).getRelativeX(element);
double offsetY = ((MouseEvent<?>) event).getRelativeY(element);
return new Coordinate(offsetX, offsetY);
} else if (event instanceof TouchEvent<?>) {
Touch touch = null;
if (event instanceof TouchEndEvent) {
touch = ((TouchEvent<?>) event).getChangedTouches().get(0);
} else {
touch = ((TouchEvent<?>) event).getTouches().get(0);
}
double offsetX = touch.getRelativeX(element);
double offsetY = touch.getRelativeY(element);
return new Coordinate(offsetX, offsetY);
}
return new Coordinate(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
}
}
代码示例来源:origin: com.ahome-it/lienzo-core
final int x = event.getRelativeX(event.getRelativeElement());
final int y = event.getRelativeY(event.getRelativeElement());
final Layer layer = getSelectionShape().getLayer(); // this is in the drag layer, so also redraw there
代码示例来源:origin: ahome-it/lienzo-core
final int x = event.getRelativeX(event.getRelativeElement());
final int y = event.getRelativeY(event.getRelativeElement());
final Layer layer = getSelectionShape().getLayer(); // this is in the drag layer, so also redraw there
代码示例来源:origin: ahome-it/lienzo-core
final int x = event.getRelativeX(event.getRelativeElement());
final int y = event.getRelativeY(event.getRelativeElement());
final Layer layer = getSelectionShape().getLayer(); // this is in the drag layer, so also redraw there
内容来源于网络,如有侵权,请联系作者删除!