本文整理汇总了Java中com.google.gwt.event.dom.client.TouchEvent.preventDefault方法的典型用法代码示例。如果您正苦于以下问题:Java TouchEvent.preventDefault方法的具体用法?Java TouchEvent.preventDefault怎么用?Java TouchEvent.preventDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.TouchEvent
的用法示例。
在下文中一共展示了TouchEvent.preventDefault方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapTouchMove
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
public void onMapTouchMove(TouchEvent<?> event) {
if (event.getTouches().length() == 2 && zooming) {
Coordinate p1 = getWorldLocation(event.getTouches().get(0), RenderSpace.WORLD);
Coordinate p2 = getWorldLocation(event.getTouches().get(1), RenderSpace.WORLD);
double scale = MathService.distance(p1, p2) / startDist;
Coordinate newCenter = getCenter(p1, p2);
double dx = startCenter.getX() - newCenter.getX();
double dy = startCenter.getY() - newCenter.getY();
double resolution = mapPresenter.getViewPort().getResolution() / scale;
Coordinate position = calculatePosition(scale, startCenter);
View view = new View(new Coordinate(position.getX() + dx, position.getY() + dy), resolution);
view.setInteractive(true);
mapPresenter.getViewPort().applyView(view);
} else {
onDrag(event);
}
event.preventDefault();
event.stopPropagation();
}
示例2: onMapTouchStart
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
public void onMapTouchStart(TouchEvent<?> event) {
if (event.getTouches().length() == 2) {
Coordinate p1 = getWorldLocation(event.getTouches().get(0), RenderSpace.WORLD);
Coordinate p2 = getWorldLocation(event.getTouches().get(1), RenderSpace.WORLD);
startCenter = getCenter(p1, p2);
startDist = MathService.distance(p1, p2);
stopPanning(null);
this.zooming = true;
} else {
onDown(event);
}
event.preventDefault();
event.stopPropagation();
}
示例3: onMapTouchEnd
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
public void onMapTouchEnd(TouchEvent<?> event) {
if (zooming) {
if (event.getTouches().length() == 0) {
zooming = false;
}
mapPresenter.getViewPort().stopInteraction();
} else {
onUp(event);
}
event.preventDefault();
event.stopPropagation();
}
示例4: onMapTouchStart
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
/**
* Forward as mouse down and stop the event.
* @since 2.4.0
*/
@Override
public void onMapTouchStart(TouchEvent<?> event) {
onDown(event);
event.stopPropagation();
event.preventDefault();
}
示例5: onMapTouchMove
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
/**
* Forward as mouse move and stop the event.
* @since 2.4.0
*/
@Override
public void onMapTouchMove(TouchEvent<?> event) {
onDrag(event);
event.stopPropagation();
event.preventDefault();
}
示例6: onMapTouchEnd
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
/**
* Forward as mouse up and stop the event.
* @since 2.4.0
*/
@Override
public void onMapTouchEnd(TouchEvent<?> event) {
onUp(event);
event.stopPropagation();
event.preventDefault();
}
示例7: onMapTouchCancel
import com.google.gwt.event.dom.client.TouchEvent; //导入方法依赖的package包/类
/**
* Forward as mouse up and stop the event.
* @since 2.4.0
*/
@Override
public void onMapTouchCancel(TouchEvent<?> event) {
onUp(event);
event.stopPropagation();
event.preventDefault();
}