coronalabs / framework-composer

Corona composer.* framework
https://docs.coronalabs.com/api/library/composer/
2 stars 4 forks source link

Remove dead code, fix bugs and correct display issues #2

Closed XeduR closed 3 years ago

XeduR commented 3 years ago

This pull request does several things.

Firstly, it removes dead code. The current version of Composer has many local variables that are created, but aren't actually used for anything at all, or they are used to calculate new values that themselves are never used.

Secondly, Composer had a bug where the invisible sensor that was supposed to block all touch and tap events during scene transitions was too small on certain displays if their aspect ratio didn't match the content area defined in the build.settings. Additionally, this sensor, and the modal overlay sensor, would not adjust to device orientation changes. To address this issue, the sensors are now set to be so large that even if they become misaligned, they should still block touches on all devices.

Thirdly, and related to the previous issues, the scene transition effects were not using correct display dimensions. This resulted in some scene transitions to abruptly jump into the screen even though they were supposed to slide from behind some edge of the display. The scene transition effects were also stuck to the initial device orientation display values and so rotating the device after requiring composer would lead to the scene transitions no longer working as intended.

To address these orientation issues, this PR introduces lib.trackOrientation( track ) and lib.updateOrientation() functions. The former adds or removes an orientation Runtime listener that will automatically update the scene transition effects table if the device orientation changes. The latter gives the developer an option to manually update the table if they don't wish to use the listener.

Finally, this PR introduces a new option to not load composer GUI related functions. By default, Composer is set to require physics and json libraries, as well as several unnecessary functions that were a part of the long abandoned Composer GUI Beta. By assigning the property lib.loadComposerGUI = false before creating the first scene object, the Composer library will not require "composer_scene" file, but instead setup the necessary class and functions within the "composer.lua" file, thus not loading any unnecessary libraries or functions.

Shchvova commented 3 years ago

Why did you close it?

XeduR commented 3 years ago

I mentioned the issues briefly on Discord via personal messages on 12 September.

I'll be making a few more clean ups and fixes to Composer. Then I'll open a new PR.