-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(all): update panScale for panning sensitivity when size is changed. #209
Conversation
when fov is changed, updateControlScale will be called. It's proper time to setPanScale.
With some test case Ref naver#204
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
src/PanoViewer/PanoViewer.js
Outdated
|
||
let containerSize; | ||
|
||
if (!size !== undefined || size.width !== undefined || size.height !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that updateViewportDimensions
can make simple using destructuring assignment.
How about it?
updateViewportDimensions(size={width:undefined, height:undefined}) {
if (!this._isReady) {
return this;
}
let containerSize;
let [width, height] = size;
if (width !== undefined || height !== undefined) {
containerSize = window.getComputedStyle(this._container);
width = parseInt(containerSize.width, 10);
height = parseInt(containerSize.height, 10);
}
// Skip if viewport is not changed.
if (width === this._width && height === this._height) {
return this;
}
this._width = width;
this._height = height;
this._aspectRatio = width / height;
this._photoSphereRenderer.updateViewportDimensions(width, height);
this._yawPitchControl.option("aspectRatio", this._aspectRatio);
this._yawPitchControl.updatePanScale({height});
this.lookAt({}, 0);
return this;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mixed Thank you for suggestion. That makes code more neat!
I'll apply it except the some logical part. Because there's some difference that I've intended.
* If at least one of them is changed, this function need to be called. | ||
* @param {*} param0 | ||
*/ | ||
updatePanScale(param) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
updatePanScale(param={}){
const areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mixed I'll apply it! Thank you 👍
Issue
#204