Skip to content
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

Merged
merged 8 commits into from
May 11, 2018

Conversation

jongmoon
Copy link

Issue

#204

@coveralls
Copy link

coveralls commented May 11, 2018

Coverage Status

Coverage increased (+0.6%) to 93.044% when pulling 37e853b on jongmoon:FullScreen#204 into fb8d2c9 on naver:master.

Copy link
Member

@mixed mixed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.


let containerSize;

if (!size !== undefined || size.width !== undefined || size.height !== undefined) {
Copy link
Member

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;
}

Copy link
Author

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) {
Copy link
Member

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);
}

Copy link
Author

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 👍

@jongmoon jongmoon merged commit 6adcc21 into naver:master May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants