Hi,
-- I created this peace of code:
canvas = Canvas.createIfSupported();
context = canvas.getContext2d();
canvas.setCoordinateSpaceWidth(WIDTH);
canvas.setCoordinateSpaceHeight(HEIGHT);
panel.add(canvas);
canvas.addTouchStartHandler(new TouchStartHandler() {
@Override
public void onTouchStart(TouchStartEvent event) {
JsArray<Touch> changedTouches = event.getChangedTouches();
if (changedTouches.length() > 0) {
context.beginPath();
int offsetLeft = canvas.getAbsoluteLeft();
int offsetTop = canvas.getAbsoluteTop();
context.fillRect(changedTouches.get(0).getPageX()
- offsetLeft, changedTouches.get(0).getPageY()
- offsetTop, 10, 10);
context.stroke();
}
// context.moveTo(changedTouches.get(0).getPageX() - offsetLeft,
// changedTouches.get(0).getPageY() - offsetTop);
event.preventDefault();
}
});
Problem is that every single touch generates two rectangulars on the screen? What is wrong with my code ?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment