Closed aproni34f closed 1 year ago
The way this function is constructed, if you are calling lookAt(pitch, yaw...) callback is fired for every property. Is this a desired behavior since animated is the same time for all? Shouldnt you return one callback for all properties?
this.lookAt = function(pitch, yaw, hfov, animated, callback, callbackArgs) { animated = animated == undefined ? 1000: Number(animated); console.log(animated) if (pitch !== undefined && Math.abs(pitch - config.pitch) > eps) { this.setPitch(pitch, animated, callback, callbackArgs); callback = undefined; } if (yaw !== undefined && Math.abs(yaw - config.yaw) > eps) { this.setYaw(yaw, animated, callback, callbackArgs); callback = undefined; } if (hfov !== undefined && Math.abs(hfov - config.hfov) > eps) { this.setHfov(hfov, animated, callback, callbackArgs); callback = undefined; } if (typeof callback == 'function') callback(callbackArgs); return this; }
callback is fired for every property
No, it isn't. It is only fired once. After the first time, the callback variable is set to undefined, so it isn't used again.
callback
undefined
The way this function is constructed, if you are calling lookAt(pitch, yaw...) callback is fired for every property. Is this a desired behavior since animated is the same time for all? Shouldnt you return one callback for all properties?