magic-script / magic-script-components-lumin

MagicScript Components renderer for Lumin Runtime platform
Apache License 2.0
4 stars 0 forks source link

Custom components ignore Layout's defaultItemAlignment and defaultItemPadding #111

Open asharma-ml opened 4 years ago

asharma-ml commented 4 years ago

When adding a custom component to a Layout, the component ignores the default item alignment and padding. Other items added to the Layout are correctly rendered with the defaults.

      <MSC.GridLayout
        name={"GridLayout1"}
        columns={0}
        rows={0}
        skipInvisibleItems={false}
        defaultItemAlignment={"top-left"}
        defaultItemPadding={[0.03, 0.03, 0.03, 0.03]}
        size={[0, 0]}
      >
        <MSC.Image
          name={"Image1"}
          texCoords={[[0, 1], [1, 1], [1, 0], [0, 0]]}
          color={[1, 1, 1, 1]}
          opaque={false}
          ui={false}
          width={0.2}
          height={0.2}
        />
        <MSC.Content
          localPosition= {[0, 0, 0]}
          localRotation= {[0, 0, 0, 1]}
          localScale= {[1, 1, 1]}
        >
        {/* CUSTOM COMPONENT: */}
        <Comp/>
        {/* CUSTOM COMPONENT: */}
        </MSC.Content>
      </MSC.GridLayout>

GridTest.zip

asharma-ml commented 4 years ago

Wrapping the custom component in a View does adhere to the default alignment and paddings:

        <MSC.View
          localPosition= {[0, 0, 0]}
          localRotation= {[0, 0, 0, 1]}
          localScale= {[1, 1, 1]}
        >
        {/* CUSTOM COMPONENT: */}
        <Comp/>
        {/* CUSTOM COMPONENT: */}
        </MSC.View>
grozdanov commented 4 years ago

MXSCOMP-202