From be766cda59c6d84737804b5405a7fff5bce41202 Mon Sep 17 00:00:00 2001 From: Colin Kallemein Date: Thu, 13 Jun 2024 23:31:11 +0200 Subject: [PATCH] Custom select + styling toolbar --- public/assets/icons/zoneEditor/chevron.svg | 4 + .../utilities/zoneEditor/Toolbar.vue | 114 ++++++++++++++++-- 2 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 public/assets/icons/zoneEditor/chevron.svg diff --git a/public/assets/icons/zoneEditor/chevron.svg b/public/assets/icons/zoneEditor/chevron.svg new file mode 100644 index 0000000..87ea829 --- /dev/null +++ b/public/assets/icons/zoneEditor/chevron.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/components/utilities/zoneEditor/Toolbar.vue b/src/components/utilities/zoneEditor/Toolbar.vue index 79093ff..4dbbb1e 100644 --- a/src/components/utilities/zoneEditor/Toolbar.vue +++ b/src/components/utilities/zoneEditor/Toolbar.vue @@ -2,11 +2,13 @@
- +
- +
- +
-
+
@@ -58,6 +90,11 @@ const props = defineProps({ const scene = useScene() const emit = defineEmits(['move', 'eraser', 'pencil', 'save']) +// track select state +let selectPencilOpen = ref(false); +let selectEraserOpen = ref(false); + + // drawMode const drawMode = ref('tile') @@ -119,12 +156,11 @@ function clear() { position: fixed; top: 20px; border-radius: 5px; - opacity: 0.8; display: flex; - background: $dark-gray; + background: rgba($dark-gray, 0.8); border: 2px solid $cyan; color: $light-gray; - padding: 5px; + padding: 5px 5px 5px 10px; min-width: 90%; height: 40px; @@ -138,13 +174,73 @@ function clear() { } // vertical center - button { + .tool { display: flex; justify-content: center; align-items: center; + min-width: 40px; + padding: 0; + + select { + display: none; + } &.active { border-bottom: 3px solid $light-cyan; + gap: 10px; + } + + .select { + position: relative; + .select-trigger { + text-transform: capitalize; + display: flex; + gap: 15px; + + img { + transform: rotate(0); + transition: ease-in-out 0.2s; + } + + &.open { + img { + transform: rotate(180deg); + } + } + } + .options { + display: flex; + flex-direction: column; + position: absolute; + top: calc(100% + 20px); + left: 50%; + transform: translateX(-50%); + background: rgba($dark-gray, 0.8); + border-radius: 5px; + min-width: 100px; + border: 1px solid $cyan; + text-align: left; + .option { + padding: 8px 10px; + position: relative; + &:hover { + background-color: rgba($cyan, 0.5); + } + &::after { + content: ''; + position: absolute; + width: 80%; + left: 50%; + transform: translateX(-50%); + bottom: 0; + height: 1px; + background-color: $cyan; + } + &:last-child::after { + display: none; + } + } + } } }