GPUPickEvent

This commit is contained in:
tengge1 2019-11-20 20:54:04 +08:00
parent 366f497668
commit 8aa0f3d188
2 changed files with 31 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import RenderEvent from './RenderEvent';
import ResizeEvent from './ResizeEvent';
import FilterEvent from './FilterEvent';
import ViewEvent from './ViewEvent';
import GPUPickEvent from './GPUPickEvent';
import TransformControlsEvent from './TransformControlsEvent';
import ObjectEvent from './ObjectEvent';
@ -33,6 +34,7 @@ function EventDispatcher() {
new ResizeEvent(),
new FilterEvent(),
new ViewEvent(),
new GPUPickEvent(),
// viewport中的事件
new TransformControlsEvent(),

View File

@ -0,0 +1,29 @@
import BaseEvent from './BaseEvent';
/**
* 使用GPU进行碰撞
* @author tengge / https://github.com/tengge1
* @param {*} app 应用程序
*/
function GPUPickEvent(app) {
BaseEvent.call(this, app);
this.onMouseMove = this.onMouseMove.bind(this);
}
GPUPickEvent.prototype = Object.create(BaseEvent.prototype);
GPUPickEvent.prototype.constructor = GPUPickEvent;
GPUPickEvent.prototype.start = function () {
app.on(`mousemove.${this.id}`, this.onMouseMove);
};
GPUPickEvent.prototype.stop = function () {
app.on(`mousemove.${this.id}`, null);
};
GPUPickEvent.prototype.onMouseMove = function (event) {
};
export default GPUPickEvent;