1. A concise explanation of the problem you’re experiencing.
Hey, I’m learning Cesium source code, but I feel uncertain about the sceond argument of ScreenSpaceEventHandler
like https://github.com/AnalyticalGraphicsInc/cesium/blob/1.61/Source/Widgets/CesiumWidget/CesiumWidget.js#L340 :
this._screenSpaceEventHandler = new ScreenSpaceEventHandler(canvas, false);
the second argument is false, and https://github.com/AnalyticalGraphicsInc/cesium/blob/1.61/Source/Scene/CameraEventAggregator.js#L265 :
this._eventHandler = new ScreenSpaceEventHandler(canvas, true);
the sceond argument is true. However, the ScreenSpaceEventHandler constructor function just accepts one argument, https://github.com/AnalyticalGraphicsInc/cesium/blob/1.61/Source/Core/ScreenSpaceEventHandler.js#L693 :
function ScreenSpaceEventHandler(element) {
…
}
So, what is the mean of the second argument ?
Hope your reply, thanks.
omar
September 10, 2019, 3:58pm
2
It looks like many years ago, there existed a second argument:
* Handles user input events. Custom functions can be added to be executed on
* when the user enters input.
*
* @alias ScreenSpaceEventHandler
*
* @param {Canvas} [element=document] The element to add events to.
* @param {Boolean} [mouseMoveOnDocument=true] Listen for mouse/pointer/touch down and move events on the document.
*
* @constructor
*/
var ScreenSpaceEventHandler = function(element, mouseMoveOnDocument) {
this._inputEvents = {};
this._buttonDown = undefined;
this._isPinching = false;
this._seenAnyTouchEvents = false;
this._primaryStartPosition = new Cartesian2();
this._primaryPosition = new Cartesian2();
this._primaryPreviousPosition = new Cartesian2();
this._positions = new AssociativeArray();
But it’s been deprecated and removed, and that code just hasn’t been updated. Feel free to open a pull request to fix that, your contribution would be much appreciated!
Thanks for your reply, it helps me a lot.
在 2019年9月10日星期二 UTC+8下午11:58:11,Omar Shehata写道: