|
8 | 8 | </div> |
9 | 9 |
|
10 | 10 | <div class="vue-flow-viewport"> |
| 11 | + <div class="toggle-grid-button" @click="showGrid = !showGrid">#</div> |
| 12 | + |
11 | 13 | <VueFlow |
12 | 14 | v-model:nodes="projectStore.nodes" |
13 | 15 | v-model:edges="projectStore.edges" |
14 | 16 | :default-viewport="{ zoom: 2 }" |
15 | 17 | :max-zoom="2" |
16 | 18 | :min-zoom="0.1" |
17 | 19 | :fit-view-on-init="true" |
18 | | - :snap-to-grid="true" |
19 | 20 | > |
20 | | - <!-- <Background |
21 | | - variant="lines" |
22 | | - style="{z-index: -1}" |
23 | | - /> --> |
| 21 | + <Background v-if="showGrid" variant="lines" :size="51" :gap="51" /> |
24 | 22 | <div class="create-wrapper"> |
25 | 23 | <div v-if="showInput" class="floating-create-expanded"> |
26 | 24 | <button class="collapse-btn" @click="showInput = false"> |
@@ -82,12 +80,14 @@ import { useProjectStore } from "@/stores/useProjectStore" |
82 | 80 | import { VueFlow } from "@vue-flow/core" |
83 | 81 | import { useModalStore } from "@/stores/useModalStore" |
84 | 82 | import type { RelationalRelationField, RelationalField } from "@/types.types" |
| 83 | +import { Background } from "@vue-flow/background" |
85 | 84 |
|
86 | 85 | const projectStore = useProjectStore() |
87 | 86 | const modalStore = useModalStore() |
88 | 87 |
|
89 | 88 | const modelName = ref("") |
90 | 89 | const showInput = ref(false) |
| 90 | +const showGrid = ref(false) |
91 | 91 |
|
92 | 92 | const handleCreateClick = () => { |
93 | 93 | if (modelName.value.trim() === "") return |
@@ -167,6 +167,30 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) => |
167 | 167 | height: calc(100% - 42px); |
168 | 168 | } |
169 | 169 |
|
| 170 | +.toggle-grid-button { |
| 171 | + caret-color: transparent; |
| 172 | + position: absolute; |
| 173 | + top: 10px; |
| 174 | + right: 10px; |
| 175 | + background-color: var(--color-primary); |
| 176 | + color: black; |
| 177 | + border: 2px solid black; |
| 178 | + padding: 3px 6px; |
| 179 | + font-weight: bold; |
| 180 | + border-radius: 8px; |
| 181 | + cursor: pointer; |
| 182 | + z-index: 10; |
| 183 | + box-shadow: 2px 2px 0px rgba(0, 0, 0, 1); |
| 184 | + transition: |
| 185 | + transform 0.1s ease-out, |
| 186 | + box-shadow 0.1s; |
| 187 | +} |
| 188 | +
|
| 189 | +.toggle-grid-button:hover { |
| 190 | + box-shadow: 0px 0px 0px rgba(0, 0, 0, 1); |
| 191 | + transform: translate(2px, 2px); |
| 192 | +} |
| 193 | +
|
170 | 194 | .create-wrapper { |
171 | 195 | position: absolute; |
172 | 196 | top: 10px; |
@@ -247,6 +271,7 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) => |
247 | 271 | cursor: pointer; |
248 | 272 | font-weight: bold; |
249 | 273 | } |
| 274 | +
|
250 | 275 | .create-model-btn:hover { |
251 | 276 | background-color: var(--color-success); |
252 | 277 | } |
|
0 commit comments