LivelyKernel / lively.morphic

An implementation of the Morphic user interface framework for lively.next.
13 stars 2 forks source link

load world dialog broken #151

Closed rksm closed 6 years ago

rksm commented 7 years ago

@merryman

due to style-widgets branch merge:

To reproduce: world menu => load world,

Error:

Error in interactive command load world: TypeError: Cannot read property 'width' of undefined
TypeError: Cannot read property 'width' of undefined
    at CenteredTilingLayout.TilingLayout_getOptimalWidth_ (http://localhost:9011/lively.morphic/layout.js:839:36)
    at CenteredTilingLayout_apply_ (http://localhost:9011/lively.morphic/layout.js:888:32)
    at CenteredTilingLayout.set (http://localhost:9011/lively.morphic/layout.js:785:20)
    at ObjectRef_recreatePropertyAndSetProperty_ (http://localhost:9011/lively.serializer2/object-pool.js:557:29)
    at ObjectRef_recreateObjFromSnapshot_ (http://localhost:9011/lively.serializer2/object-pool.js:543:24)
    at Function.ObjectRef_fromSnapshot_ (http://localhost:9011/lively.serializer2/object-pool.js:592:47)
    at ObjectRef_recreateProperty_ (http://localhost:9011/lively.serializer2/object-pool.js:584:173)
    at ObjectRef_recreatePropertyAndSetProperty_ (http://localhost:9011/lively.serializer2/object-pool.js:557:55)
    at LivelyClassPropertiesPlugin_additionallyDeserializeBeforeProperties_ (http://localhost:9011/lively.serializer2/plugins.js:276:21)
    at ObjectPool_plugin_additionallyDeserializeBeforeProperties_ (http://localhost:9011/lively.serializer2/object-pool.js:335:93)
merryman commented 7 years ago

This is a problem that occurs when a layout's properties are deserialized in an invalid order. In that concrete case, spacing is deserialized before container is set, so the relayout that is triggered by the set of spacing crashes. Is there a way to define order of properties for plain lively classes aka static get properties() in morphs?

merryman commented 7 years ago

So b4ace7ae2e42199 puts a convention into place that was already present in other layouts, where the apply would be canceled in case the container is not set yet. however ordering property initialization remains the more elegant solution.