Skip to content

Commit e91ba53

Browse files
committed
feat(Frontend v2): Viewport Background
1 parent 6f5b1f2 commit e91ba53

4 files changed

Lines changed: 49 additions & 7 deletions

File tree

frontend/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"format": "prettier --write src/"
1414
},
1515
"dependencies": {
16+
"@vue-flow/background": "^1.3.2",
1617
"@vue-flow/core": "^1.45.0",
1718
"cytoscape": "^3.32.1",
1819
"pinia": "^3.0.3",

frontend/src/components/schema_editor/CustomNode.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const closeNodeActions = () => {
8080
border-radius: 6px;
8181
width: 250px;
8282
overflow: hidden;
83+
background-color: white;
8384
}
8485
8586
.custom-node-header {
@@ -116,6 +117,7 @@ const closeNodeActions = () => {
116117
display: flex;
117118
flex-direction: column;
118119
cursor: pointer;
120+
119121
}
120122
121123
.custom-node-field-row {

frontend/src/components/schema_editor/SchemaEditor.vue

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@
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"
8287
import { VueFlow } from "@vue-flow/core"
8388
import { useModalStore } from "@/stores/useModalStore"
8489
import type { RelationalRelationField, RelationalField } from "@/types.types"
90+
import { Background } from '@vue-flow/background'
8591
8692
const projectStore = useProjectStore()
8793
const modalStore = useModalStore()
8894
8995
const modelName = ref("")
9096
const showInput = ref(false)
97+
const showGrid = ref(false)
9198
9299
const 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

Comments
 (0)