From 42482304ac1076ac912c71650c09a3371b1c396b Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 19 Mar 2022 21:27:20 +1100 Subject: Add coloured-outline for hovered-over headers --- src/components/Tile.vue | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'src/components') diff --git a/src/components/Tile.vue b/src/components/Tile.vue index 411ba76..f84c7e0 100644 --- a/src/components/Tile.vue +++ b/src/components/Tile.vue @@ -161,6 +161,7 @@ export default defineComponent({ }, }, methods: { + // For tile expansion and collapse onLeafClick(){ this.$emit('leaf-clicked', this.layoutNode); // Increase z-index and hide overflow during transition @@ -181,6 +182,27 @@ export default defineComponent({ onInnerHeaderClicked(node: LayoutNode){ this.$emit('header-clicked', node); }, + // For coloured-outlines on hovered-over leaf-tiles or non-leaf-headers + onMouseEnter(evt){ + if (!this.isLeaf){ + this.$refs.nonLeaf.classList.replace('shadow-normal', 'shadow-highlight'); + if (this.$refs.sepSweptArea != null){ + this.$refs.sepSweptArea.classList.replace('shadow-normal', 'shadow-highlight'); + } + } else if (this.isExpandable){ + evt.target.classList.replace('shadow-normal', 'shadow-highlight'); + } + }, + onMouseLeave(evt){ + if (!this.isLeaf){ + this.$refs.nonLeaf.classList.replace('shadow-highlight', 'shadow-normal'); + if (this.$refs.sepSweptArea != null){ + this.$refs.sepSweptArea.classList.replace('shadow-highlight', 'shadow-normal'); + } + } else if (this.isExpandable){ + evt.target.classList.replace('shadow-highlight', 'shadow-normal'); + } + }, }, }); @@ -188,20 +210,23 @@ export default defineComponent({