JSNI機能を使用して、非常に便利なキャンバスとアニメーションライブラリをGWTに移植します。私は、この特定のコンストラクタで少しの援助を使用することができますラップしています最初のライブラリビーイング:GWTのEasleJSライブラリからMouseEventコンストラクタをラップするにはどうすればよいですか?
/**
* This is passed as the parameter to onPress, onMouseMove, onMouseUp, onMouseDown, and onClick handlers on
* DisplayObject instances.
* By default, mouse events are disabled for performance reasons. In order to enabled them for a specified stage
* set mouseEventsEnabled to true on your stage instance.
* @class MouseEvent
* @constructor
* @param {String} type The event type.
* @param {Number} stageX The mouseX position relative to the stage.
* @param {Number} stageY The mouseY position relative to the stage.
* @param {DisplayObject} target The display object this event relates to.
* @param {MouseEvent} nativeEvent The native DOM event related to this mouse event.
**/
var MouseEvent = function(type, stageX, stageY, target, nativeEvent) {
this.initialize(type, stageX, stageY, target, nativeEvent);
}
var p = MouseEvent.prototype;
あなたはここでクラス全体を表示することができます:http://easeljs.com/docs/MouseEvent.js.html
私の質問は、私は、イベントを渡して行くのですか、ですGWTからこのクラスのJSNIコンストラクタに正常にフィードしますか?
FYI:TimelipのGWTポートであるEaseljs(0.2.1)をフォークしています。最新のイーゼル機能(0.4.0)を追加するように更新しています。 https://github.com/timknip/easel-gwt
EDIT:ネイティブイベントは、あなたがJavaで記述した関数であると思いますか?あなたがどこかでキャンバスをクリックしたときにONMOUSEUPイベントを追加し、ロジックが "onClickSomeButton()"と書かれた関数に保持されている場合、このコンストラクタのパラメータとしてこのメソッドを渡したいとしますか?私はJavaがパラメータとしてメソッドを渡すことはできませんが、いくつかの抽象GWTクラスを拡張することでこれをラップする方法はないと思いますか?
ありがとうございました。ドキュメントを調べた後、私はオーバーレイタイプが正確に私が必要としていたことを実感し、その答えはいつも私の鼻の下にあった。非常に感謝しています。これはいつか私にとっては今のところ問題でした。 :) – LoneWolf