@abi-software/mapintegratedvuer 1.16.3-simulation.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConnectivityGraph-DbqPx-8k.js +125 -0
- package/dist/{ContentMixin-CN4E1Tcm.js → ContentMixin-R9Bw7Ou4.js} +545 -270
- package/dist/Flatmap-BYUfDJ9B.js +202 -0
- package/dist/{Iframe-NY9zAQZz.js → Iframe-2ofJ9NJW.js} +2 -2
- package/dist/{MultiFlatmap-C8gAg-MI.js → MultiFlatmap-CYxpB20e.js} +25 -18
- package/dist/{Plot-DH_Px9IB.js → Plot-DmQzP7lz.js} +2 -2
- package/dist/{Scaffold-C6XY3IQb.js → Scaffold-C8x1IHb9.js} +53 -79
- package/dist/Simulation-D9pblkqI.js +28 -0
- package/dist/{index-DaB85Tpy.js → index-raNlNgsS.js} +30069 -28444
- package/dist/mapintegratedvuer.js +1 -1
- package/dist/mapintegratedvuer.umd.cjs +238 -4270
- package/dist/{DynamicMarkerMixin-ToiTtIcj.js → style-QpNSY6to.js} +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -11
- package/src/App.vue +265 -283
- package/src/assets/styles.scss +1 -1
- package/src/components/ContentVuer.vue +5 -1
- package/src/components/ContextCard.vue +1 -0
- package/src/components/EventBus.js +3 -0
- package/src/components/MapContent.vue +9 -8
- package/src/components/SplitDialog.vue +5 -6
- package/src/components/SplitFlow.vue +491 -469
- package/src/components/scripts/utilities.js +16 -1
- package/src/components/viewers/ConnectivityGraph.vue +146 -0
- package/src/components/viewers/Flatmap.vue +84 -136
- package/src/components/viewers/MultiFlatmap.vue +9 -5
- package/src/components/viewers/Simulation.vue +15 -66
- package/src/components.d.ts +1 -3
- package/src/main.js +3 -9
- package/src/mixins/ContentMixin.js +391 -420
- package/src/stores/connectivities.js +6 -1
- package/src/stores/entries.js +1 -1
- package/src/stores/splitFlow.js +366 -427
- package/dist/Flatmap-D7eEw_Q5.js +0 -103398
- package/dist/Simulation-Bb3HbeD4.js +0 -72
- package/src/components/DummyRouteComponent.vue +0 -1
- package/src/components/EventBus.ts +0 -13
- package/src/components/FloatingWindow.vue +0 -125
- package/src/components/PlotComponent.vue +0 -56
- package/src/services/mapping.js +0 -69
- package/src/stores/mapping.js +0 -29
- package/src/stores/simulationPlotStore.js +0 -104
- package/src/types/simulation.js +0 -18
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { _ as r, E as i } from "./index-DaB85Tpy.js";
|
|
2
|
-
import { C as d } from "./ContentMixin-CN4E1Tcm.js";
|
|
3
|
-
import { SimulationVuer as u } from "@abi-software/simulationvuer";
|
|
4
|
-
import { resolveComponent as l, openBlock as c, createBlock as m } from "vue";
|
|
5
|
-
const p = {
|
|
6
|
-
name: "Simulation",
|
|
7
|
-
mixins: [d],
|
|
8
|
-
components: {
|
|
9
|
-
SimulationVuer: u
|
|
10
|
-
},
|
|
11
|
-
computed: {
|
|
12
|
-
id: function() {
|
|
13
|
-
return this.entry.resource ? this.entry.resource : this.entry.discoverId;
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
methods: {
|
|
17
|
-
handleDataNotification: function(o) {
|
|
18
|
-
i.emit("simulation-response", o);
|
|
19
|
-
},
|
|
20
|
-
handleDataRequest(o) {
|
|
21
|
-
this.processRequest(o);
|
|
22
|
-
},
|
|
23
|
-
handleWindowClosed(o) {
|
|
24
|
-
var t;
|
|
25
|
-
(t = this.$refs.simulation) == null || t.removeDataSubscription(o.id);
|
|
26
|
-
},
|
|
27
|
-
processRequest: function(o) {
|
|
28
|
-
var e, n;
|
|
29
|
-
if (o.id !== "nz.ac.auckland.simulation-data-request") return;
|
|
30
|
-
if (parseInt(o.version.split(".")[0]) !== 0) {
|
|
31
|
-
console.warn("Unsupported simulation request version:", o.version);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
((e = o.payload.protocol) == null ? void 0 : e.resource) === this.id && ((n = this.$refs.simulation) == null || n.addDataSubscription({
|
|
35
|
-
id: o.id,
|
|
36
|
-
version: o.version,
|
|
37
|
-
payload: {
|
|
38
|
-
windowId: o.payload.windowId,
|
|
39
|
-
ownerId: o.payload.ownerId,
|
|
40
|
-
component: o.payload.component,
|
|
41
|
-
variable: o.payload.variable,
|
|
42
|
-
withVOI: !0
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
mounted: function() {
|
|
48
|
-
i.on("simulation-data-request", this.handleDataRequest), i.on("plot-window-closed", this.handleWindowClosed), i.emit("simulation-ready", {
|
|
49
|
-
resourceId: this.id,
|
|
50
|
-
ready: !0
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
beforeUnmount: function() {
|
|
54
|
-
i.emit("simulation-ready", {
|
|
55
|
-
resourceId: this.id,
|
|
56
|
-
ready: !1
|
|
57
|
-
}), i.off("simulation-data-request", this.handleDataRequest), i.off("plot-window-closed", this.handleWindowClosed);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
function f(o, t, e, n, h, a) {
|
|
61
|
-
const s = l("SimulationVuer");
|
|
62
|
-
return c(), m(s, {
|
|
63
|
-
apiLocation: o.apiLocation,
|
|
64
|
-
id: a.id,
|
|
65
|
-
ref: "simulation",
|
|
66
|
-
onDataNotification: a.handleDataNotification
|
|
67
|
-
}, null, 8, ["apiLocation", "id", "onDataNotification"]);
|
|
68
|
-
}
|
|
69
|
-
const D = /* @__PURE__ */ r(p, [["render", f]]);
|
|
70
|
-
export {
|
|
71
|
-
D as default
|
|
72
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<template></template>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import mitt from 'mitt';
|
|
2
|
-
import type { SimulationRequest, SimulationResponse } from '../types/simulation';
|
|
3
|
-
|
|
4
|
-
// Define the mapping of Event Name -> Event Payload
|
|
5
|
-
type Events = {
|
|
6
|
-
'simulation-data-request': SimulationRequest;
|
|
7
|
-
'simulation-data-ready': SimulationResponse;
|
|
8
|
-
[key: string]: any; // Allow for other events with any payload.
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// Pass the type to mitt
|
|
12
|
-
const EventBus = mitt<Events>();
|
|
13
|
-
export default EventBus;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, toRefs, watch } from 'vue'
|
|
3
|
-
import { useDraggable } from '@vueuse/core'
|
|
4
|
-
|
|
5
|
-
const props = defineProps(['windowData', 'offsetX', 'offsetY'])
|
|
6
|
-
const emit = defineEmits(['closeWindow', 'mouseDown'])
|
|
7
|
-
const { windowData } = toRefs(props)
|
|
8
|
-
|
|
9
|
-
// 1. Create a template ref for the DOM element
|
|
10
|
-
const el = ref(null)
|
|
11
|
-
|
|
12
|
-
// 2. Create a "handle" ref so the user can only drag by the header
|
|
13
|
-
const handle = ref(null)
|
|
14
|
-
|
|
15
|
-
const transform = ref('translate(0px, 0px)')
|
|
16
|
-
const isMinimized = ref(false)
|
|
17
|
-
const toggleMinimize = () => {
|
|
18
|
-
isMinimized.value = !isMinimized.value
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
watch(
|
|
22
|
-
[() => props.offsetX, () => props.offsetY],
|
|
23
|
-
([newX, newY]) => {
|
|
24
|
-
transform.value = `translate(-${newX}px, -${newY}px)`
|
|
25
|
-
},
|
|
26
|
-
{ immediate: true }
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
// 3. Activate draggable logic
|
|
30
|
-
// We set initialValue to the props so it opens where we want
|
|
31
|
-
const { x, y, style } = useDraggable(el, {
|
|
32
|
-
initialValue: { x: windowData.value.x, y: windowData.value.y },
|
|
33
|
-
handle: handle, // Only drag when clicking the header
|
|
34
|
-
preventDefault: true,
|
|
35
|
-
})
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<template>
|
|
39
|
-
<div
|
|
40
|
-
ref="el"
|
|
41
|
-
class="floating-window"
|
|
42
|
-
:class="{ 'is-minimized': isMinimized }"
|
|
43
|
-
:style="[style, { zIndex: windowData.zIndex, transform: transform }]"
|
|
44
|
-
@mousedown="emit('mouseDown', windowData.id)"
|
|
45
|
-
>
|
|
46
|
-
<div ref="handle" class="window-header">
|
|
47
|
-
<span>{{ windowData.data?.title }}</span>
|
|
48
|
-
<div class="window-controls">
|
|
49
|
-
<button @click.stop="toggleMinimize" class="control-btn">
|
|
50
|
-
{{ isMinimized ? '□' : '_' }}
|
|
51
|
-
</button>
|
|
52
|
-
<button @click.stop="emit('closeWindow', windowData.id)">×</button>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="window-body" v-show="!isMinimized">
|
|
57
|
-
<slot></slot>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
<style scoped>
|
|
63
|
-
.floating-window {
|
|
64
|
-
position: absolute; /* Fixed relative to viewport */
|
|
65
|
-
width: 400px;
|
|
66
|
-
min-width: 200px;
|
|
67
|
-
height: 300px;
|
|
68
|
-
min-height: 150px;
|
|
69
|
-
background: white;
|
|
70
|
-
border: 1px solid #ccc;
|
|
71
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
resize: both; /* Allow resizing */
|
|
75
|
-
overflow: hidden; /* Prevent content overflow */
|
|
76
|
-
transition: height 0.2s ease, width 0.2s ease;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.window-header {
|
|
80
|
-
background: #f0f0f0;
|
|
81
|
-
padding: 8px;
|
|
82
|
-
cursor: grab; /* Shows user it is draggable */
|
|
83
|
-
display: flex;
|
|
84
|
-
justify-content: space-between;
|
|
85
|
-
border-bottom: 1px solid #ddd;
|
|
86
|
-
user-select: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.window-header:active {
|
|
90
|
-
cursor: grabbing;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.window-body {
|
|
94
|
-
flex-grow: 1;
|
|
95
|
-
width: 100%;
|
|
96
|
-
height: 100%;
|
|
97
|
-
position: relative;
|
|
98
|
-
padding: 10px;
|
|
99
|
-
/* overflow: hidden; Important for Plotly resizing */
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.floating-window.is-minimized {
|
|
103
|
-
height: auto !important;
|
|
104
|
-
min-height: 0 !important;
|
|
105
|
-
resize: none; /* Disable resizing when minimized */
|
|
106
|
-
width: 250px; /* Optional: shrink the width to make a neat little bar */
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.window-controls {
|
|
110
|
-
display: flex;
|
|
111
|
-
gap: 5px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.control-btn {
|
|
115
|
-
background: transparent;
|
|
116
|
-
border: 1px solid #ccc;
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
padding: 0 5px;
|
|
119
|
-
border-radius: 3px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.control-btn:hover {
|
|
123
|
-
background: #e0e0e0;
|
|
124
|
-
}
|
|
125
|
-
</style>
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, onMounted, watch } from 'vue';
|
|
3
|
-
import Plotly from 'plotly.js-dist-min';
|
|
4
|
-
import { useResizeObserver, useDebounceFn } from '@vueuse/core';
|
|
5
|
-
|
|
6
|
-
const props = defineProps(['data']);
|
|
7
|
-
const plotContainer = ref(null);
|
|
8
|
-
|
|
9
|
-
const drawPlot = () => {
|
|
10
|
-
if (!plotContainer.value) return;
|
|
11
|
-
|
|
12
|
-
const plotData = [{
|
|
13
|
-
x: props.data?.x || [],
|
|
14
|
-
y: props.data?.y || [],
|
|
15
|
-
type: 'scatter'
|
|
16
|
-
}];
|
|
17
|
-
|
|
18
|
-
const layout = {
|
|
19
|
-
margin: { t: 20, r: 20, b: 40, l: 40 }, // Tight margins for small windows
|
|
20
|
-
autosize: true
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const config = { responsive: true }; // Helps with window resize, but not enough for container resize
|
|
24
|
-
|
|
25
|
-
Plotly.newPlot(plotContainer.value, plotData, layout, config);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Debounce this so we don't spam Plotly while the user is actively dragging
|
|
29
|
-
const handleResize = useDebounceFn(() => {
|
|
30
|
-
if (plotContainer.value) {
|
|
31
|
-
Plotly.Plots.resize(plotContainer.value);
|
|
32
|
-
}
|
|
33
|
-
}, 50); // 50ms delay
|
|
34
|
-
|
|
35
|
-
// Observe resizes, useResizeObserver automatically cleans up when component unmounts
|
|
36
|
-
useResizeObserver(plotContainer, () => {
|
|
37
|
-
handleResize();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
onMounted(() => {
|
|
41
|
-
drawPlot();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
watch(() => props.data, drawPlot, { deep: true });
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<template>
|
|
48
|
-
<div ref="plotContainer" class="plot-container"></div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<style scoped>
|
|
52
|
-
.plot-container {
|
|
53
|
-
width: 100%;
|
|
54
|
-
height: 100%;
|
|
55
|
-
}
|
|
56
|
-
</style>
|
package/src/services/mapping.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import readXlsxFile from 'read-excel-file'
|
|
2
|
-
|
|
3
|
-
const BASE_URL =
|
|
4
|
-
'https://raw.githubusercontent.com/hsorby/fc-feature-mapping/main/'
|
|
5
|
-
const INDEX_FILE = 'mapping_index.json'
|
|
6
|
-
|
|
7
|
-
export class MappingService {
|
|
8
|
-
// Find the correct Excel file for the current Flatmap
|
|
9
|
-
static async getMappingIndex() {
|
|
10
|
-
try {
|
|
11
|
-
// Fetch the master index
|
|
12
|
-
const response = await fetch(`${BASE_URL}${INDEX_FILE}`)
|
|
13
|
-
if (!response.ok) throw new Error('Failed to fetch index')
|
|
14
|
-
|
|
15
|
-
const index = await response.json()
|
|
16
|
-
|
|
17
|
-
return index || null
|
|
18
|
-
} catch (e) {
|
|
19
|
-
console.error('Error finding map mapping:', e)
|
|
20
|
-
return null
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Fetch and Parse the Excel file
|
|
25
|
-
static async loadMapping(index) {
|
|
26
|
-
const flatmapMap = new Map()
|
|
27
|
-
|
|
28
|
-
for (const entry in index) {
|
|
29
|
-
try {
|
|
30
|
-
const filename = index[entry]
|
|
31
|
-
|
|
32
|
-
const response = await fetch(`${BASE_URL}${filename}`)
|
|
33
|
-
if (!response.ok) throw new Error(`Failed to fetch ${filename}`)
|
|
34
|
-
|
|
35
|
-
// Get the binary data
|
|
36
|
-
const blob = await response.blob()
|
|
37
|
-
|
|
38
|
-
// Parse with read-excel-file
|
|
39
|
-
// rows is an array of arrays: [ ["Header1", "Header2"], ["Row1Col1", "Row1Col2"] ]
|
|
40
|
-
const rows = await readXlsxFile(blob)
|
|
41
|
-
|
|
42
|
-
// Remove header row
|
|
43
|
-
const headers = rows.shift()
|
|
44
|
-
const nameIndex = headers.indexOf('Name')
|
|
45
|
-
const componentIndex = headers.indexOf('Component')
|
|
46
|
-
const flatmapIdIndex = headers.indexOf('Flatmap ID')
|
|
47
|
-
|
|
48
|
-
// Convert to a Lookup Map for fast access
|
|
49
|
-
// Assuming Column 0 = FlatmapID, Column 1 = Component, Column 2 = Variable
|
|
50
|
-
const lookup = new Map()
|
|
51
|
-
|
|
52
|
-
rows.forEach((row) => {
|
|
53
|
-
const flatmapId = row[flatmapIdIndex]
|
|
54
|
-
const component = row[componentIndex]
|
|
55
|
-
const variable = row[nameIndex]
|
|
56
|
-
|
|
57
|
-
if (flatmapId && component && variable) {
|
|
58
|
-
lookup.set(flatmapId, { component, variable })
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
flatmapMap.set(entry, lookup)
|
|
62
|
-
} catch (e) {
|
|
63
|
-
console.error('Error parsing mapping file:', e)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return flatmapMap
|
|
68
|
-
}
|
|
69
|
-
}
|
package/src/stores/mapping.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { MappingService } from '../services/mapping'
|
|
3
|
-
|
|
4
|
-
export const useMappingStore = defineStore('mapping', {
|
|
5
|
-
state: () => ({
|
|
6
|
-
elementMap: new Map(),
|
|
7
|
-
}),
|
|
8
|
-
|
|
9
|
-
actions: {
|
|
10
|
-
async initializeMapping() {
|
|
11
|
-
this.elementMap.clear()
|
|
12
|
-
|
|
13
|
-
// Find which file to load
|
|
14
|
-
const index = await MappingService.getMappingIndex()
|
|
15
|
-
|
|
16
|
-
if (index) {
|
|
17
|
-
// Parse and store
|
|
18
|
-
this.elementMap = await MappingService.loadMapping(index)
|
|
19
|
-
} else {
|
|
20
|
-
console.warn('No index found.')
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
// Helper to get data for a specific element ID
|
|
25
|
-
mapToCellMLIdentifiers(flatmapUuid, flatmapElementId) {
|
|
26
|
-
return this.elementMap.get(flatmapUuid)?.get(flatmapElementId) || { component: undefined, variable: undefined }
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
})
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
import EventBus from '../components/EventBus'
|
|
4
|
-
|
|
5
|
-
const BASE_Z_INDEX = 100
|
|
6
|
-
|
|
7
|
-
export const useSimulationPlotStore = defineStore('simulationPlot', () => {
|
|
8
|
-
const windows = ref([])
|
|
9
|
-
const zStack = ref([])
|
|
10
|
-
const simulationEntries = ref({})
|
|
11
|
-
|
|
12
|
-
function initListeners() {
|
|
13
|
-
EventBus.on('simulation-response', handleSimulationResponse)
|
|
14
|
-
EventBus.on('simulation-ready', handleSimulationReady)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function cleanupListeners() {
|
|
18
|
-
EventBus.off('simulation-response', handleSimulationResponse)
|
|
19
|
-
EventBus.off('simulation-ready', handleSimulationReady)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function removeWindow(windowId) {
|
|
23
|
-
const targetWindow = windows.value.find(win => win.id === windowId)
|
|
24
|
-
if (!targetWindow) return
|
|
25
|
-
windows.value = windows.value.filter((win) => win.id !== windowId)
|
|
26
|
-
zStack.value = zStack.value.filter((stackId) => stackId !== windowId)
|
|
27
|
-
EventBus.emit('plot-window-closed', { id: targetWindow.id})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function refreshZIndices() {
|
|
31
|
-
windows.value.forEach((win) => {
|
|
32
|
-
// Find where this window sits in the stack
|
|
33
|
-
const stackIndex = zStack.value.indexOf(win.id)
|
|
34
|
-
|
|
35
|
-
// If found, assign zIndex. If not (error case), keep it low.
|
|
36
|
-
if (stackIndex !== -1) {
|
|
37
|
-
win.zIndex = BASE_Z_INDEX + stackIndex
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function bringToFront(windowId) {
|
|
43
|
-
const stackIndex = zStack.value.indexOf(windowId)
|
|
44
|
-
if (stackIndex === -1) return // Should not happen
|
|
45
|
-
|
|
46
|
-
zStack.value.splice(stackIndex, 1)
|
|
47
|
-
|
|
48
|
-
zStack.value.push(windowId)
|
|
49
|
-
|
|
50
|
-
refreshZIndices()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function handleSimulationReady(data) {
|
|
54
|
-
simulationEntries.value[data.resourceId] = { ready: data.ready }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function requestSimulation(data) {
|
|
58
|
-
if (data.protocol === null || !simulationEntries.value[data.protocol?.resource]?.ready) return
|
|
59
|
-
|
|
60
|
-
let targetWindow = windows.value.find(win => win.id === data.windowId)
|
|
61
|
-
if (!targetWindow) {
|
|
62
|
-
targetWindow = {
|
|
63
|
-
id: data.windowId,
|
|
64
|
-
ownerId: data.ownerId,
|
|
65
|
-
data: null,
|
|
66
|
-
zIndex: BASE_Z_INDEX,
|
|
67
|
-
x: data.position.x + data.offset.left,
|
|
68
|
-
y: data.position.y + data.offset.top,
|
|
69
|
-
}
|
|
70
|
-
windows.value.push(targetWindow)
|
|
71
|
-
zStack.value.push(targetWindow.id)
|
|
72
|
-
refreshZIndices()
|
|
73
|
-
} else {
|
|
74
|
-
bringToFront(targetWindow.id)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
EventBus.emit('simulation-data-request', {
|
|
78
|
-
id: 'nz.ac.auckland.simulation-data-request',
|
|
79
|
-
version: '0.1.0',
|
|
80
|
-
payload: data,
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function handleSimulationResponse(response) {
|
|
85
|
-
if (response.id !== 'nz.ac.auckland.simulation-data-response') return
|
|
86
|
-
const targetWindow = windows.value.find(win => win.id === response.payload.windowId)
|
|
87
|
-
|
|
88
|
-
if (targetWindow) {
|
|
89
|
-
targetWindow.data = response.payload.data
|
|
90
|
-
} else {
|
|
91
|
-
console.warn('Received simulation response for unknown window ID:', response.payload.windowId)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
windows,
|
|
97
|
-
bringToFront,
|
|
98
|
-
cleanupListeners,
|
|
99
|
-
handleSimulationResponse,
|
|
100
|
-
requestSimulation,
|
|
101
|
-
initListeners,
|
|
102
|
-
removeWindow,
|
|
103
|
-
}
|
|
104
|
-
})
|
package/src/types/simulation.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const SIMULATION_REQUEST_ID = 'nz.ac.auckland.simulation-data-request'
|
|
2
|
-
export const SIMULATION_REQUEST_VERSION = '0.1.0'
|
|
3
|
-
|
|
4
|
-
// export type RequestId = typeof SIMULATION_REQUEST_ID
|
|
5
|
-
|
|
6
|
-
// // Definition of the request.
|
|
7
|
-
// export interface SimulationRequest {
|
|
8
|
-
// id: RequestId
|
|
9
|
-
// component: string // e.g., 'main'
|
|
10
|
-
// variable: string // e.g., 'v_W_GI'
|
|
11
|
-
// version: string // e.g., '0.1.0'
|
|
12
|
-
// identifier: string // e.g., 'bvc/ID-0000040'
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// // Definition of the response.
|
|
16
|
-
// export interface SimulationResponse {
|
|
17
|
-
// [variableName: string]: number[] | Float32Array
|
|
18
|
-
// }
|