Skip to content
This repository was archived by the owner on Oct 28, 2020. It is now read-only.

Fix problems with window.orientation deprecation (FIXES HTML-199)#24

Open
ckissane wants to merge 1 commit into
Catrobat:developfrom
ckissane:develop
Open

Fix problems with window.orientation deprecation (FIXES HTML-199)#24
ckissane wants to merge 1 commit into
Catrobat:developfrom
ckissane:develop

Conversation

@ckissane
Copy link
Copy Markdown

Replaces instances of:
window.orientation
With
((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined))
This fixes:
https://jira.catrob.at/browse/HTML-199

@wintersw
Copy link
Copy Markdown
Contributor

Thanks for contributing.
Is this an issue already? Which browser do you use?
Anyway, that change isn't that easy because window is a global object that isn't used correctly across our whole project.
As far as I know there are browsers supporting Screen but do not return an angle or an unified angle at all.
We also have to consider change-events especially for our rendering on mobile devices.
Refactoring should be encapsulated in a global scope and reused across the project.
Have you considered to write it as:
let vo = window.orientation || (window.screen && window.screen.orientation) ? window.screen.orientation.angle : undefined

@ckissane
Copy link
Copy Markdown
Author

Ah I see the problems with my solution,

@ckissane
Copy link
Copy Markdown
Author

Should I implement the window orientation in smartjs/sj.js then use it across the whole project?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants