scarlettgamestudio / scarlett-editor

Scarlett Editor repository
https://scarlett.cothesia.com/
Apache License 2.0
15 stars 1 forks source link

Inspector Container's SubContainer? #19

Open Apidcloud opened 7 years ago

Apidcloud commented 7 years ago

Problem

Let's say we have a class composition such as Text[DropShadow[Stroke[Color]]]

Where Color is the only class with a specific inspector editor.

How is inspector supposed to draw dropshadow properties?

Currently, it doesn't show its property Stroke because the inspector getPropertyContainers depth limit is 1. Going further one more level (see the example below) just makes Stroke appear in a different container.

function getPropertyContainers(object) {
            let propertyContainers = [];
            propertyContainers.push(createPropertyContainerFromObject(object));

            let ownContainerProperties = getObjectOwnContainerProperties(object);
            ownContainerProperties.forEach(function (property) {
                propertyContainers.push(createPropertyContainerFromObject(object[property]));

                const propertyOwnContainer = getObjectOwnContainerProperties(object[property]);

                propertyOwnContainer.forEach(function (subProperty) {
                    propertyContainers.push(createPropertyContainerFromObject(object[property][subProperty]));
                });

            });

            return propertyContainers;
        }

Which results in: image

Expected Behavior

It's open to discussion, but showing the stroke properties inside dropshadow container is a possible solution.

Apidcloud commented 6 years ago

I have come up with a solution, but it relies on knowing which editors are available. It fetches the properties when it's populating an already separate (own) container (e.g., dropshadow) and custom editor rule isn't set nor available. Syncing isn't working yet though. Not sure if multiple definitions need some work as well.

Result: image

Thoughts?