From 0b3308ebfd60d4f5312358e7f83782f24e6299df Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Fri, 28 May 2021 19:11:15 -0400 Subject: [PATCH] mod icon --- index.html | 134 ++++++++++++++--------------------------------------- 1 file changed, 34 insertions(+), 100 deletions(-) diff --git a/index.html b/index.html index 5c56ae9..1ab0c40 100755 --- a/index.html +++ b/index.html @@ -218,7 +218,8 @@ var Pivot = Row:clone, IndexPivot:indexPivot, IndexSum:inSumIndicies, - Leaves:[] + Leaves:[], + Depth:depth }; // grow a child off of the parent using the meta object N.Connect(inParent, N.Create(match), "Hierarchy"); @@ -543,63 +544,43 @@ let Section = props => `; } -let Modifier = props => -{ - let refNode = N.Step(props.modifier, "ModifyAt", false)[0]; - - let handleDelete = () => - { - Pivot.Unmodify(props.modifier); - Render(); - }; - - let displayFields = []; - N.Walk(node=>{ - displayFields.push(html``) - }, Pivot.Schema, "sum"); - - - return html` -
-
${refNode.Meta.Label}
- -
- `; -} - let ModificationsIcon = ({node}) => { - let modsUp = /*N.Step(node, "ModifyUp", false)||[]*/[true]; - let modsDown = /*N.Step(node, "ModifyDown", false)||[]*/[true, true]; - let modsAt = /*N.Step(node, "ModifyAt", false)||[]*/[true, true, true]; - let modsOut = /*N.Step(node, "ModifyOut", false)||[]*/[]; + let modsUp = N.Step(node, "ModifyUp", false)||[]; + let modsDown = N.Step(node, "ModifyDown", false)||[]; + let modsAt = N.Step(node, "ModifyAt", false)||[]; + let modsOut = N.Step(node, "ModifyOut", false)||[]; + + let padding = 7; + let icon = 0; let styles = css` position:relative; display:inline-block; - width:25px; - height:25px; - margin-left:100px; + vertical-align:middle; + width:${padding*2 + icon}px; + height:${padding*2 + icon}px; + margin:${padding}; .Icon { position:absolute; display:inline-block; - width:25px; - height:25px; + width:${padding*2 + icon}px; + height:${padding*2 + icon}px; text-align:center; font-size:9px; font-family:sans-serif; font-weight:900; - line-height:25px; + line-height:${padding*2 + icon}px; &::after { content:" "; display:block; position:absolute; - width:5px; - height:5px; - border:10px solid transparent; + width:${icon}px; + height:${icon}px; + border:${padding}px solid transparent; } &.Down @@ -653,63 +634,8 @@ let ModificationsIcon = ({node}) => `; - let otherStyles = css` - position:relative; - left:100px; - width:5px; - height:5px; - border:20px solid transparent; - background:black; - - &.Down - { - border-top-color:orange; - } - &.At - { - border-right-color:red; - } - &.Up - { - border-bottom-color:lightblue; - } - &.Out - { - border-left:grey; - } - - .Icon - { - position:absolute; - width:20px; - height:20px; - - &.Down - { - bottom:35px; - left:0; - } - &.At - { - left:35px; - top:0; - } - &.Up - { - top:35px; - left:0; - } - &.Out - { - right:35px; - top:0; - } - - } - `; - return html` -
+
${modsDown.length ? html`
${modsDown.length}
` : null} ${modsAt.length ? html`${modsAt.length}` : null} ${modsUp.length ? html`${modsUp.length}` : null} @@ -736,12 +662,24 @@ let PivotBranch = props => } }); + let modifier = N.Step(props.node, "ModifyAt", false); + let modifierDisplay = false; + if(modifier) + { + modifierDisplay = html``; + } + else + { + modifierDisplay = html``; + } + return html` - ${props.node.Meta.Label} - + <${ModificationsIcon} node=${props.node}> + ${props.node.Meta.Label} + ${modifierDisplay} ${displayCells} @@ -782,9 +720,6 @@ let PivotRoot = ({pivot}) => <${Section} key="settings" label=${`Settings`}> - <${Section} key="modifiers" label=${`Modifiers (${modifiers.length})`}> - ${ !modifiers.length ? html`No modifiers` : modifiers.map( m => html`<${Modifier} modifier=${m}/>`)} - <${Section} key="tree" label=${"Tree"}> ${rows} @@ -799,7 +734,6 @@ let ElRoot = props => let pivots = N.Step(Pivot.Root, "Pivot")||[]; return h("div", null, [ h(PivotForm), - h(ModificationsIcon, null, null), pivots.map(pivot=>h(PivotRoot, {key:pivot.Meta.Label, pivot})) ]) };