Skip to content

Place object in the same position whether the device is in landscape or portrait orientation on iOS(location-based)#165

Open
tanababy wants to merge 2 commits into
AR-js-org:devfrom
tanababy:dev
Open

Place object in the same position whether the device is in landscape or portrait orientation on iOS(location-based)#165
tanababy wants to merge 2 commits into
AR-js-org:devfrom
tanababy:dev

Conversation

@tanababy

@tanababy tanababy commented Sep 2, 2020

Copy link
Copy Markdown

⚠️ All PRs have to be done versus 'dev' branch, so be aware of that, or we'll close your issue ⚠️

What kind of change does this PR introduce?

When the device is moved from portrait to landscape on the iPhone, the placed objects are moved by 90 degrees.
My intention is that the object is placed in the same place when the device is in landscape orientation as it is when it is in portrait orientation.
While the above intention is successful on Android smartphones, this is not the case on the iPhone.
This is a bug that only happens on the iPhone.

Perhaps it has something to do with the way the iPhone gets the device angle.( webkitCompassHeading )

The approach I've considered is to rotate the camera as the device rotates.
Since safari's iOS has window.orientation, we add this value to the angle.

Can it be referenced to an Issue? If so what is the issue # ?

How can we test it?

Use any of location-based examples with the modified code.

Summary

On iOS, the objects appear to be in the same location regardless of the orientation of the device as on Android devices.

Does this PR introduce a breaking change?
No

Please TEST your PR before proposing it. Specify here what device you have used for tests, version of OS and version of Browser
iPhoneX, mobile Safari, iOS 13.6.1

Other information

@tanababy

tanababy commented Sep 2, 2020

Copy link
Copy Markdown
Author

I'm very sorry, I was wrong about the indentation rules...
I only changed line 337 of gps-camera.js. But if it doesn't work, I'll recreate the pr.

@tanababy tanababy changed the title Place object in the same position whether the device is in landscape or portrait orientation(location-based) Place object in the same position whether the device is in landscape or portrait orientation on iOS(location-based) Sep 3, 2020
@nicolocarpignoli

Copy link
Copy Markdown
Member

Hi! Thanks for the PR. Do you have tested this in both Android and iOS?

@tanababy

tanababy commented Sep 4, 2020

Copy link
Copy Markdown
Author

@nicolocarpignoli
Thanks for your reply.
Yes, here are the devices I tested:

iOS: iPhoneX(13.6.1)& iPhone11(13.65.1) browser: safari
Android: ASUS Zenfone Live (8.0.0) browser: chrome

@sinano1107

Copy link
Copy Markdown

I strongly hope that this PR will solve the problem
Switching between portrait and landscape mode causes the t-rex to turn to the right or left.

@kalwalt kalwalt added location based iOS all about iOS devices labels Dec 22, 2024
@kalwalt

kalwalt commented Dec 22, 2024

Copy link
Copy Markdown
Member

To all here: this is still valid? Unfortunately i haven't a iOS device so can not test...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iOS all about iOS devices location based

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants