いくつか試した後、gwt-g2dソースを編集して解決策を見つけました。
gwt-g2dは、サーフェスごとにキャンバスを使用してdivを作成します。ここで、Surfaceを変更して、position:absoluteのキャンバスのみを作成しました。今、私は複数のキャンバスを作成し、その関数IsPointInPathを使用しています。
Surface.javaの変更:
public Surface(int width, int height) {
canvas = Document.get().createElement("canvas").cast();
setElement(Document.get().createDivElement());
getElement().appendChild(canvas);
canvasInitializer.init(canvas, width, height);
setStylePrimaryName("g2d-Surface");
this.width = width;
this.height = height;
context = canvas.getContext2D();
}
に:
public Surface(int width, int height) {
canvas = Document.get().createElement("canvas").cast();
canvas.setAttribute("style", "position:absolute;");
setElement(canvas);
canvasInitializer.init(canvas, width, height);
setStylePrimaryName("g2d-Surface");
this.width = width;
this.height = height;
context = canvas.getContext2D();
}