Skip to content

Commit 6b5ff15

Browse files
committed
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Front into fix_order_of_items
2 parents ec011fc + 70748e8 commit 6b5ff15

33 files changed

+533
-392
lines changed

.github/workflows/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"node": true,
3+
"integration": true,
4+
"microservices": "tests/integration/microservices"
5+
}

.github/workflows/schedule.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Schedule
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
type: string
8+
default: "next"
9+
schedule:
10+
- cron: 0 23 * * *
11+
12+
jobs:
13+
schedule:
14+
uses: Geode-solutions/actions/.github/workflows/js-schedule.yml@master
15+
with:
16+
repos: ${{ vars.REPOS }}
17+
branch: ${{ inputs.branch || 'next' }}
18+
secrets: inherit

.github/workflows/test.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@ on:
77
- next
88

99
jobs:
10-
test-integration:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: Node setup
15-
uses: actions/setup-node@v4
16-
with:
17-
node-version: 22
18-
- name: Python setup
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: 3.12
22-
- name: Install python dependencies
23-
run: |
24-
cd ./tests/integration/microservices/viewer
25-
python3 -m venv venv
26-
source venv/bin/activate
27-
pip install --extra-index-url https://wheels.vtk.org -r requirements.txt
28-
- name: Install and run tests
29-
run: |
30-
npm i
31-
32-
npm run test:integration
3310
test:
3411
uses: Geode-solutions/actions/.github/workflows/js-test.yml@master
3512
with:

.github/workflows/test_pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ jobs:
99
uses: Geode-solutions/actions/.github/workflows/js-test-pr.yml@master
1010
with:
1111
repos: ${{ vars.REPOS }}
12-
integration: false
1312
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ venv
2727
.pytest_cache
2828
__snapshots__
2929
coverage
30+
*.db
3031
# package-lock.json

.oxlintrc.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,29 @@
77
"style": "error",
88
"restriction": "error"
99
},
10-
"plugins": ["import", "node", "oxc", "promise", "unicorn", "vitest"]
10+
"plugins": ["import", "node", "oxc", "promise", "unicorn", "vitest"],
11+
"rules": {
12+
"unicorn/filename-case": [
13+
"error",
14+
{
15+
"case": "snakeCase"
16+
}
17+
],
18+
"eslint/func-style": [
19+
"error",
20+
{
21+
"style:": "declaration"
22+
}
23+
],
24+
"eslint/sort-keys": "off",
25+
"eslint/no-ternary": "off"
26+
},
27+
"overrides": [
28+
{
29+
"files": ["**/components/*"],
30+
"rules": {
31+
"unicorn/filename-case": "PascalCase"
32+
}
33+
}
34+
]
1135
}

components/HybridRenderingView.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<VeaseViewToolbar />
55
<slot name="ui"></slot>
66
<v-col
7+
class="pa-0"
78
ref="viewer"
8-
style="overflow: hidden; position: relative; z-index: 0"
9-
:style="{ height: viewerHeight }"
9+
style="height: 100%; overflow: hidden; position: relative; z-index: 0"
1010
@click="get_x_y"
1111
@keydown.esc="viewerStore.toggle_picking_mode(false)"
1212
/>
@@ -15,13 +15,6 @@
1515
</template>
1616

1717
<script setup>
18-
const props = defineProps({
19-
height: {
20-
type: String,
21-
default: "100%",
22-
},
23-
})
24-
2518
const emit = defineEmits(["click"])
2619
2720
const container = useTemplateRef("viewer")
@@ -30,8 +23,6 @@
3023
const { windowWidth, windowHeight } = useWindowSize()
3124
const { width, height } = useElementSize(container)
3225
33-
const viewerHeight = computed(() => props.height)
34-
3526
const debouncedResize = debounce(() => {
3627
hybridViewerStore.resize(width.value, height.value)
3728
}, 100)
@@ -65,3 +56,9 @@
6556
emit("click", event)
6657
}
6758
</script>
59+
60+
<style>
61+
img {
62+
pointer-events: none;
63+
}
64+
</style>

components/Viewer/ContextMenu.vue

Lines changed: 120 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@
33
v-model="show_menu"
44
content-class="circular-menu"
55
:style="getMenuStyle()"
6+
:close-on-content-click="false"
7+
:close-delay="100"
68
>
7-
<div
8-
class="circular-menu-items"
9-
:style="{ width: `${radius * 2}px`, height: `${radius * 2}px` }"
10-
>
11-
<component
12-
v-for="(item, index) in menu_items"
13-
:is="item"
14-
:key="index"
15-
:itemProps="{
16-
id: props.id,
17-
tooltip_location: getTooltipLocation(index),
18-
tooltip_origin: getTooltipOrigin(index),
19-
}"
20-
class="menu-item-wrapper"
21-
:style="getItemStyle(index)"
22-
/>
9+
<div class="circular-menu-drag-handle" @mousedown.stop="startDrag">
10+
<div
11+
class="circular-menu-items"
12+
:style="{ width: `${radius * 2}px`, height: `${radius * 2}px` }"
13+
>
14+
<component
15+
v-for="(item, index) in menu_items"
16+
:is="item"
17+
:key="index"
18+
:itemProps="{
19+
id: props.id,
20+
tooltip_location: getTooltipLocation(index),
21+
tooltip_origin: getTooltipOrigin(index),
22+
}"
23+
class="menu-item-wrapper"
24+
:style="getItemStyle(index)"
25+
@mousedown.stop
26+
/>
27+
</div>
2328
</div>
2429
</v-menu>
2530
</template>
@@ -40,12 +45,60 @@
4045
const itemId = props.id || menuStore.current_id
4146
return itemId ? dataBaseStore.itemMetaDatas(itemId) : {}
4247
})
48+
4349
const radius = 80
4450
const show_menu = ref(true)
51+
const isDragging = ref(false)
52+
const dragStartX = ref(0)
53+
const dragStartY = ref(0)
54+
const menuX = ref(props.x || menuStore.menuX)
55+
const menuY = ref(props.y || menuStore.menuY)
56+
57+
const { pause: pauseDragListeners, resume: resumeDragListeners } =
58+
useEventListener(
59+
"mousemove",
60+
(e) => {
61+
if (!isDragging.value) return
62+
handleDrag(e)
63+
},
64+
{ passive: true },
65+
)
66+
67+
const { pause: pauseStopListeners, resume: resumeStopListeners } =
68+
useEventListener("mouseup", (e) => {
69+
if (!isDragging.value) return
70+
stopDrag(e)
71+
})
4572
46-
watch(show_menu, (value) => {
47-
if (!value) {
48-
menuStore.closeMenu()
73+
useEventListener(
74+
"touchstart",
75+
(e) => {
76+
startDrag(e.touches[0])
77+
e.preventDefault()
78+
},
79+
{ passive: false },
80+
)
81+
82+
useEventListener(
83+
"touchmove",
84+
(e) => {
85+
if (!isDragging.value) return
86+
handleDrag(e.touches[0])
87+
e.preventDefault()
88+
},
89+
{ passive: false },
90+
)
91+
92+
useEventListener("touchend", (e) => {
93+
if (!isDragging.value) return
94+
stopDrag(e.changedTouches[0])
95+
})
96+
97+
watch(show_menu, (newVal) => {
98+
if (!newVal && isDragging.value) {
99+
setTimeout(() => {
100+
show_menu.value = true
101+
}, 10)
49102
}
50103
})
51104
@@ -58,18 +111,42 @@
58111
59112
const menuItemCount = computed(() => menu_items.value.length)
60113
61-
function getMenuStyle() {
62-
const x = props.x || menuStore.menuX
63-
const y = props.y || menuStore.menuY
64-
const width = props.containerWidth || menuStore.containerWidth
65-
const height = props.containerHeight || menuStore.containerHeight
114+
function startDrag(e) {
115+
isDragging.value = true
116+
dragStartX.value = e.clientX - menuX.value
117+
dragStartY.value = e.clientY - menuY.value
118+
resumeDragListeners()
119+
resumeStopListeners()
120+
e.preventDefault()
121+
}
66122
67-
const adjustedX = Math.min(Math.max(x, radius), width - radius)
68-
const adjustedY = Math.min(Math.max(y, radius), height - radius)
123+
function handleDrag(e) {
124+
if (!isDragging.value) return
125+
menuX.value = e.clientX - dragStartX.value
126+
menuY.value = e.clientY - dragStartY.value
69127
128+
menuX.value = Math.min(
129+
Math.max(menuX.value, radius),
130+
props.containerWidth - radius,
131+
)
132+
menuY.value = Math.min(
133+
Math.max(menuY.value, radius),
134+
props.containerHeight - radius,
135+
)
136+
}
137+
138+
function stopDrag(e) {
139+
isDragging.value = false
140+
pauseDragListeners()
141+
pauseStopListeners()
142+
e.stopPropagation()
143+
menuStore.setMenuPosition(menuX.value, menuY.value)
144+
}
145+
146+
function getMenuStyle() {
70147
return {
71-
left: `${adjustedX - radius}px`,
72-
top: `${adjustedY - radius}px`,
148+
left: `${menuX.value - radius}px`,
149+
top: `${menuY.value - radius}px`,
73150
}
74151
}
75152
@@ -92,9 +169,7 @@
92169
function getItemStyle(index) {
93170
const angle = (index / menuItemCount.value) * 2 * Math.PI
94171
return {
95-
transform: `translate(${Math.cos(angle) * radius}px, ${
96-
Math.sin(angle) * radius
97-
}px)`,
172+
transform: `translate(${Math.cos(angle) * radius}px, ${Math.sin(angle) * radius}px)`,
98173
transition: "opacity 0.1s ease, transform 0.1s ease",
99174
position: "absolute",
100175
}
@@ -106,6 +181,20 @@
106181
position: absolute;
107182
border-radius: 50%;
108183
background-color: rgba(0, 0, 0, 0.8);
184+
user-select: none;
185+
cursor: grab;
186+
z-index: 1000;
187+
}
188+
189+
.circular-menu-drag-handle {
190+
width: 100%;
191+
height: 100%;
192+
border-radius: 50%;
193+
cursor: grab;
194+
}
195+
196+
.circular-menu-drag-handle:active {
197+
cursor: grabbing;
109198
}
110199
111200
.circular-menu-items {

components/Viewer/Generic/Mesh/EdgesOptions.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ContextMenuItem
2+
<ViewerContextMenuItem
33
:itemProps="props.itemProps"
44
tooltip="Edges options"
55
:btn_image="props.btn_image"
@@ -14,7 +14,7 @@
1414
/>
1515
</template>
1616
</template>
17-
</ContextMenuItem>
17+
</ViewerContextMenuItem>
1818
</template>
1919

2020
<script setup>

components/Viewer/Generic/Mesh/PolygonsOptions.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ContextMenuItem
2+
<ViewerContextMenuItem
33
:itemProps="props.itemProps"
44
:tooltip="props.tooltip"
55
:btn_image="props.btn_image"
@@ -17,7 +17,7 @@
1717
/>
1818
</template>
1919
</template>
20-
</ContextMenuItem>
20+
</ViewerContextMenuItem>
2121
</template>
2222

2323
<script setup>

0 commit comments

Comments
 (0)