augmentmy-world / arStudio

A innovative Web editor for Augmented Reality
https://webarstudio.tripod-digital.co.nz
MIT License
54 stars 34 forks source link

Issue while resizing the Timeline #18

Closed kalwalt closed 4 years ago

kalwalt commented 4 years ago

While resizing the Timeline, and maybe other windows, i get this error:

window.orientation undefined screen.orientation [object ScreenOrientation]
arcontroller.component.js?version=0.64:207 Uncaught TypeError: Cannot read property 'clientWidth' of undefined
    at arcontroller.component.js?version=0.64:207
    at Object.trigger (litegui.js:110)
    at Area.sendResizeEvent (litegui.js:3063)
    at Area.onResize (litegui.js:3043)
    at Area.sendResizeEvent (litegui.js:3053)
    at Area.onResize (litegui.js:3043)
    at HTMLDocument.inner_mouseup (litegui.js:3287)
(anonymous) @ arcontroller.component.js?version=0.64:207
trigger @ litegui.js:110
Area.sendResizeEvent @ litegui.js:3063
Area.onResize @ litegui.js:3043
Area.sendResizeEvent @ litegui.js:3053
Area.onResize @ litegui.js:3043
inner_mouseup @ litegui.js:3287
kalwalt commented 4 years ago

I can not reproduce that error now i get a bit different one while resizing the Timeline:

window.orientation undefined screen.orientation [object ScreenOrientation]
arcontroller.compone…js?version=0.64:197 Uncaught ReferenceError: canvas is not defined
    at arcontroller.compone…js?version=0.64:197
    at Object.trigger (litegui.js:110)
    at Area.sendResizeEvent (litegui.js:3063)
    at Area.onResize (litegui.js:3043)
    at Area.sendResizeEvent (litegui.js:3053)
    at Area.onResize (litegui.js:3043)
    at HTMLDocument.inner_mouseup (litegui.js:3287)

This happens if i resize the video or the Timeline ( i think if you resize one you resize also the main window) after running the play button. If you re-play the video start but don't track the Hiro marker, i receive an jquery error instead:

[warning] *** Camera Parameter resized from 640, 480. ***
artoolkit.debug.js:2059 [info] Allocated videoFrameSize 307200
artoolkit.debug.js:2059 [info] Pattern detection mode set to 3.
jquery.min.js:2 Uncaught (in promise) Error: Syntax error, unrecognized expression: @ENC
    at Function.se.error (jquery.min.js:2)
    at se.tokenize (jquery.min.js:2)
    at se.select (jquery.min.js:2)
    at Function.se [as find] (jquery.min.js:2)
    at k.fn.init.find (jquery.min.js:2)
    at new k.fn.init (jquery.min.js:2)
    at k (jquery.min.js:2)
    at ArControllerComponent.<anonymous> (arcontroller.compone…js?version=0.64:172)
    at ARCameraParam.<anonymous> (artoolkit.api.js:1686)
    at writeCallback (artoolkit.api.js:1906)
arcontroller.compone…js?version=0.64:116 Register trackable - Pattern
kalwalt commented 4 years ago

Probably these errors are caused because when you switch from the scene window to the player window a canvas is created inside a <div> with id=ingametab and deleted when you come back to the scene window. Probably we can avoid this adding a if check if exist or not the canvas element and so enter or not in the routine:

https://github.com/augmentmy-world/arStudio/blob/a6c5a8cc69e626585a567e07ea9d60155eec87b6/editor/js/components/arcontroller.component.js#L156-L181

kalwalt commented 4 years ago

It is also required modify the check routine inside the resize listener:

https://github.com/augmentmy-world/arStudio/blob/a6c5a8cc69e626585a567e07ea9d60155eec87b6/editor/js/components/arcontroller.component.js#L196-L212

for the same reason.

kalwalt commented 4 years ago

It should be fixed with PR #19