mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.

Home Page:https://pannellum.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lookAt callback fires for every property

aproni34f opened this issue · comments

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.