javascript - If I have two mousewheel listeners, how do I ensure that one comes after the other? -
javascript - If I have two mousewheel listeners, how do I ensure that one comes after the other? -
i'm working on app uses three.js. i've included [fantastic] oribitalcontrols.js help scene navigation. has next code attach function mouse wheel:
this.domelement.addeventlistener( 'mousewheel', onmousewheel, false ); this.domelement.addeventlistener( 'dommousescroll', onmousewheel, false ); // firefox elsewhere in app (in separate file), have own mousewheel listener. attach event this:
this.canvas.onmousewheel = this.onmousewheel.bind(this); the problem mousewheel function tells renderer render frame, since in scene has changed. orbitalcontrols mousewheel function changes position of camera, after frame has been re-rendered. next time alter something, annoying 'zoom' because listener didn't pick lastly little alter orbitalcontrols listener.
is there way can forcefulness onmousewheel() function go last?
edit: because of architecture of app, orbitalcontrols doesn't know other mousewheel function. also, mousewheel function can't create assumptions implementation of orbitalcontrols.
both js , jquery synchronous. goal can acheieved callback function. phone call called after first functions executes completly. google callback function , find lots of examples
javascript javascript-events mousewheel
Comments
Post a Comment