Small patch for qml scene resizes
Anton Kreuzkamp
kde-development at akreuzkamp.de
Wed Mar 11 12:31:21 UTC 2015
Hi,
thanks for the input, I will look at it in detail like friday or so. I will
visit a friend of mine then, to have a one week QmlWeb-sprint (it's
primarily about the Qml-JS compiler, though).
Yes, I have seen the pull-request, I didn't have the time, though, to give it
some more thought. It has some things I'd like to rethink. I will do so, next
week as well
Cheers, Anton
PS: It would be best to register to the mailinglist
(https://mail.kde.org/mailman/listinfo/qmlweb), so you receive the mails that
are sent to the list (it doesn't have a lot of traffic ;)), and you don't have
to send it to me separately btw., I do receive mails to the list ;)
On Wednesday 11 March 2015 10:13:36 Pavel Vasev wrote:
> Hi Anton!
>
> Please consider small replacement for you code block in `function
> QMLItem(meta)`
> which rules qml scene global width/height.
> // e.g. your commit:
> https://github.com/akreuzkamp/qmlweb/commit/4c9e432e818197289154e58c31e51118
> 8835b2cf
>
> There are 2 changes.
> 1. window.onresize function is changed to addEventListener("resize") call.
> 2. In case when qml scene is placed in some dom tag (case 2),
> we have to call `self.implicitHeight =` and `self.implicitWidth =`
> each time the rootElement changes it's geometry
> to reposition child elements of qml scene
>
> Also there is a small note. Because in qmlweb implicitHeight= is chained
> to updateHGeometry,
> which in turn calls height=, which in turn sets element dom style, we have
> to set
> 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.
>
>
> ----------------------------------------------------------------------------
> ------------- // Init size of root element
> if (engine.renderMode == QMLRenderMode.DOM
> && this.$parent === null) {
> if (engine.rootElement == undefined) {
> // Case 1: Qml scene is placed in body tag
>
> // event handling by addEventListener is probably better than
> setting window.onresize
> var updateQmlGeometry = function() {
> self.implicitHeight = window.innerHeight;
> self.implicitWidth = window.innerWidth;
> }
> window.addEventListener( "resize", updateQmlGeometry );
> updateQmlGeometry();
> } else {
> // Case 2: Qml scene is placed in some element tag
>
> // we have to call `self.implicitHeight =` and
> `self.implicitWidth =`
> // each time the rootElement changes it's geometry
> // to reposition child elements of qml scene
>
> // it is good to have this as named method of dom element, so
> we can call it
> // from outside too, whenever element changes it's geometry
> (not only on window resize)
> this.dom.updateQmlGeometry = function() {
> self.implicitHeight = self.dom.offsetHeight;
> self.implicitWidth = self.dom.offsetWidth;
> };
> window.addEventListener( "resize", this.dom.updateQmlGeometry );
> this.dom.updateQmlGeometry();
> }
> }
> ----------------------------------------------------------------------------
> -------------
>
>
> p.s. BTW have you seen my pull request at github?
> https://github.com/akreuzkamp/qmlweb/pull/1
>
> Best Regards,
> Pavel
--
Kind regards to the NSA.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/qmlweb/attachments/20150311/23762c34/attachment.sig>
More information about the QmlWeb
mailing list