<div dir="ltr"><div>Hi Anton!</div><div><br></div><div>Please consider small replacement for you code block in `function QMLItem(meta)`</div><div>which rules qml scene global width/height.</div><div>// e.g. your commit: <a href="https://github.com/akreuzkamp/qmlweb/commit/4c9e432e818197289154e58c31e511188835b2cf">https://github.com/akreuzkamp/qmlweb/commit/4c9e432e818197289154e58c31e511188835b2cf</a></div><div><br></div><div>There are 2 changes.</div><div>1. window.onresize function is changed to addEventListener("resize") call.</div><div>2. In case when qml scene is placed in some dom tag (case 2), </div><div><div> we have to call `self.implicitHeight =` and `self.implicitWidth =` </div><div> each time the rootElement changes it's geometry</div><div> to reposition child elements of qml scene</div></div><div><br></div><div>Also there is a small note. Because in qmlweb implicitHeight= is chained to updateHGeometry,</div><div>which in turn calls height=, which in turn sets element dom style, we have to set</div><div>rootElement's outer width/height styles to !important. Maybe it should be noted somewhere in the docs. This note is not regarding to the current patch.</div><div><br></div><div><br></div><div>-----------------------------------------------------------------------------------------</div><div> // Init size of root element</div><div> if (engine.renderMode == QMLRenderMode.DOM</div><div> && this.$parent === null) {</div><div> if (engine.rootElement == undefined) {</div><div> // Case 1: Qml scene is placed in body tag</div><div><br></div><div> // event handling by addEventListener is probably better than setting window.onresize</div><div> var updateQmlGeometry = function() {</div><div> self.implicitHeight = window.innerHeight;</div><div> self.implicitWidth = window.innerWidth;</div><div> }</div><div> window.addEventListener( "resize", updateQmlGeometry );</div><div> updateQmlGeometry();</div><div> } else {</div><div> // Case 2: Qml scene is placed in some element tag</div><div> </div><div> // we have to call `self.implicitHeight =` and `self.implicitWidth =` </div><div> // each time the rootElement changes it's geometry</div><div> // to reposition child elements of qml scene</div><div><br></div><div><div> // it is good to have this as named method of dom element, so we can call it</div><div> // from outside too, whenever element changes it's geometry (not only on window resize)</div></div><div> this.dom.updateQmlGeometry = function() {</div><div> self.implicitHeight = self.dom.offsetHeight;</div><div> self.implicitWidth = self.dom.offsetWidth;</div><div> };</div><div> window.addEventListener( "resize", this.dom.updateQmlGeometry );</div><div> this.dom.updateQmlGeometry();</div><div> }</div><div> }</div><div>-----------------------------------------------------------------------------------------<br></div><div><br></div><div><br></div><div>p.s. BTW have you seen my pull request at github?</div><div><a href="https://github.com/akreuzkamp/qmlweb/pull/1">https://github.com/akreuzkamp/qmlweb/pull/1</a><br></div><div><br></div><div>Best Regards,</div><div>Pavel</div>
</div>