88 </div >
99
1010 <div class =" vue-flow-viewport" >
11+ <div class =" toggle-grid-button" @click =" showGrid = !showGrid" >
12+ #
13+ </div >
14+
1115 <VueFlow
1216 v-model:nodes =" projectStore.nodes"
1317 v-model:edges =" projectStore.edges"
1418 :default-viewport =" { zoom: 2 }"
1519 :max-zoom =" 2"
1620 :min-zoom =" 0.1"
1721 :fit-view-on-init =" true"
18- :snap-to-grid =" true"
1922 >
20- <!-- <Background
23+ <Background
24+ v-if =" showGrid"
2125 variant =" lines"
22- style="{z-index: -1}"
23- /> -->
26+ :size =" 51"
27+ :gap =" 51"
28+ />
2429 <div class =" create-wrapper" >
2530 <div v-if =" showInput" class =" floating-create-expanded" >
2631 <button class =" collapse-btn" @click =" showInput = false" >
@@ -82,12 +87,14 @@ import { useProjectStore } from "@/stores/useProjectStore"
8287import { VueFlow } from " @vue-flow/core"
8388import { useModalStore } from " @/stores/useModalStore"
8489import type { RelationalRelationField , RelationalField } from " @/types.types"
90+ import { Background } from ' @vue-flow/background'
8591
8692const projectStore = useProjectStore ()
8793const modalStore = useModalStore ()
8894
8995const modelName = ref (" " )
9096const showInput = ref (false )
97+ const showGrid = ref (false )
9198
9299const handleCreateClick = () => {
93100 if (modelName .value .trim () === " " ) return
@@ -167,6 +174,28 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
167174 height : calc (100% - 42px );
168175}
169176
177+ .toggle-grid-button {
178+ caret-color : transparent ;
179+ position : absolute ;
180+ top : 10px ;
181+ right : 10px ;
182+ background-color : var (--color-primary );
183+ color : black ;
184+ border : 2px solid black ;
185+ padding : 3px 6px ;
186+ font-weight : bold ;
187+ border-radius : 8px ;
188+ cursor : pointer ;
189+ z-index : 10 ;
190+ box-shadow : 2px 2px 0px rgba (0 , 0 , 0 , 1 );
191+ transition : transform 0.1s ease-out , box-shadow 0.1s ;
192+ }
193+
194+ .toggle-grid-button :hover {
195+ box-shadow : 0px 0px 0px rgba (0 , 0 , 0 , 1 );
196+ transform : translate (2px , 2px );
197+ }
198+
170199.create-wrapper {
171200 position : absolute ;
172201 top : 10px ;
@@ -191,9 +220,7 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
191220 font-weight : bold ;
192221 z-index : 10 ;
193222 box-shadow : 2px 2px 0px rgba (0 , 0 , 0 , 1 );
194- transition :
195- transform 0.1s ease-out ,
196- box-shadow 0.1s ;
223+ transition : transform 0.1s ease-out , box-shadow 0.1s ;
197224}
198225
199226.create-circle :hover {
@@ -247,6 +274,7 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
247274 cursor : pointer ;
248275 font-weight : bold ;
249276}
277+
250278.create-model-btn :hover {
251279 background-color : var (--color-success );
252280}
0 commit comments