-
Notifications
You must be signed in to change notification settings - Fork 258
Expand file tree
/
Copy pathExtra.vue
More file actions
410 lines (365 loc) · 15.5 KB
/
Copy pathExtra.vue
File metadata and controls
410 lines (365 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<template>
<QuickButtonMobile v-if="simulatorMobileStore.showQuickButtons && simulatorMobileStore.showMobileView" />
<TimingDiagramMobile v-if="simulatorMobileStore.showMobileView" v-show="simulatorMobileStore.showTimingDiagram" />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- TabsBar -->
<TabsBar />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Verilog Code Editor -->
<ExportVerilog />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Circuit Elements Panel -->
<ElementsPanel v-if="!simulatorMobileStore.showMobileView"/>
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Layout Element Panel -->
<LayoutElementsPanel />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Timing Diagram Panel -->
<TimingDiagramPanel v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Testbench -->
<TestBenchPanel v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<TestBenchCreator v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Message Display -->
<div id="MessageDiv">
<div v-for="mes in useState().successMessages" class='alert alert-success' role='alert'> {{ mes }}</div>
<div v-for="error in useState().errorMessages" class='alert alert-danger' role='alert'> {{ error }}</div>
</div>
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Verilog Editor Panel -->
<VerilogEditorPanel v-if="!simulatorMobileStore.showMobileView" />
<div id="code-window" class="code-window">
<textarea id="codeTextArea"></textarea>
</div>
<VerilogEditorPanelMobile v-if="simulatorMobileStore.showMobileView && simulatorMobileStore.showVerilogPanel" />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Element Properties Panel -->
<PropertiesPanel v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<CustomShortcut />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Save -->
<SaveImage />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Custom Themes -->
<!-- <div
id="colorThemesDialog"
class="customScroll colorThemesDialog"
tabindex="0"
style="display: none"
title="Select Theme"
></div> -->
<ApplyThemes />
<div id="CustomColorThemesDialog" class="customScroll" tabindex="0" style="display: none" title="Custom Theme">
</div>
<input id="importThemeFile" type="file" name="themeFile" style="display: none" multiple />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Simulation Area - Canvas (3) + Help Section-->
<div id="simulation" class="simulation">
<!-- <div id="restrictedDiv" class="alert alert-danger display--none"></div> -->
<div id="canvasArea" class="canvasArea">
<canvas id="backgroundArea" style="
position: absolute;
left: 0;
top: 0;
z-index: 0;
width: 100%;
height: 100%;
"></canvas>
<canvas
id="simulationArea"
style="
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
"
@touchstart="(e) => {
simulationArea.touch = true;
panStart(e)
}"
@touchend="(e) => {
simulationArea.touch = true;
panStop(e)
}"
@touchmove="(e) => {
simulationArea.touch = true;
panMove(e)
}"
@mousedown="(e) => {
simulationArea.touch = false;
panStart(e)
}"
@mousemove="(e) => {
simulationArea.touch = false;
// panMove(e); // keep OFF for now
simulationArea.mouseX = e.offsetX;
simulationArea.mouseY = e.offsetY;
const hovered = simulationArea.hover;
if (hovered && hovered.tooltipText) {
tooltip.visible = true;
tooltip.text = hovered.tooltipText;
tooltip.x = e.offsetX + 12;
tooltip.y = e.offsetY + 12;
} else {
tooltip.visible = false;
}
}"
@mouseleave="() => {
tooltip.visible = false
}"
@mouseup="(e) => {
simulationArea.touch = false;
panStop(e)
}"
></canvas>
<!-- Tooltip Overlay -->
<div
v-if="tooltip.visible"
class="custom-tooltip-styling"
:style="{
position: 'absolute',
left: tooltip.x + 'px',
top: tooltip.y + 'px',
padding: '6px 10px',
borderRadius: '8px',
fontSize: '12px',
maxWidth: '260px',
zIndex: 9999,
pointerEvents: 'none',
whiteSpace: 'pre-line'
}"
>
{{ tooltip.text }}
</div>
<div id="miniMap">
<canvas id="miniMapArea" style="position: absolute; left: 0; top: 0; z-index: 3"></canvas>
</div>
<div id="Help"></div>
<div class="sk-folding-cube loadingIcon" style="
display: none;
position: absolute;
right: 50%;
bottom: 50%;
z-index: 100;
">
<div class="sk-cube1 sk-cube"></div>
<div class="sk-cube2 sk-cube"></div>
<div class="sk-cube4 sk-cube"></div>
<div class="sk-cube3 sk-cube"></div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Combinational Analysis -->
<CombinationalAnalysis />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Testbench -->
<TestBenchValidator />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Insert Subcircuit -->
<InsertSubcircuit />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Open Project -->
<OpenOffline />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Dialog Box - Hex Bin Dec --------------------------------------------------------------------------------------------- -->
<HexBinDec />
<!-- --------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------- -->
<!---issue reporting-system----->
<ReportIssue />
<!-- --------------------------------------------------------------------------------------------- -->
<v-btn
class="cir-ele-btn"
title="Circuit Elements"
@mousedown="simulatorMobileStore.showElementsPanel = !simulatorMobileStore.showElementsPanel"
:style="{bottom: simulatorMobileStore.showElementsPanel ? '10rem' : '2rem'}"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"
>
<i class="fas fa-bezier-curve"></i>
</v-btn>
<v-btn
class="cir-btn"
title="Multi-select"
@mousedown="(e: React.MouseEvent) => {
if(simulationArea.shiftDown == false) {
simulationArea.shiftDown = true;
selectMultiple = true;
}
else {
simulationArea.shiftDown = false;
selectMultiple = false;
e.preventDefault();
}
}"
:style="{bottom: simulatorMobileStore.showElementsPanel ? '10rem' : '2rem', backgroundColor: selectMultiple ? 'var(--primary)' : 'var(--bg-toggle-btn-primary)'}"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"
>
<i class="fa-solid fa-vector-square"></i>
</v-btn>
<v-btn
class="cir-verilog-btn"
@mousedown="simulatorMobileStore.showVerilogPanel = !simulatorMobileStore.showVerilogPanel"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.isVerilog && simulatorMobileStore.showMobileView"
>
<i class="fa-solid fa-gears"></i>
</v-btn>
<v-btn
class="cir-btn"
title="Copy"
@mousedown="copyBtnClick()"
:style="{bottom: simulatorMobileStore.showElementsPanel ? '16rem' : '8rem'}"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isCopy && !simulatorMobileStore.isVerilog"
>
<i class="fa-solid fa-copy"></i>
</v-btn>
<v-btn
class="cir-btn"
title="Paste"
@mousedown="pasteBtnClick()"
:style="{bottom: simulatorMobileStore.showElementsPanel ? '16rem' : '8rem'}"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && simulatorMobileStore.isCopy && !simulatorMobileStore.isVerilog"
>
<i class="fa-solid fa-paste"></i>
</v-btn>
<v-btn
class="cir-btn"
title="Properties"
@mousedown="propertiesBtnClick()"
:style="{bottom: simulatorMobileStore.showElementsPanel ? `${propertiesPanelPos.up}rem` : `${propertiesPanelPos.down}rem`}"
v-if="simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView"
>
<i class="fa-solid fa-sliders"></i>
</v-btn>
<ElementsPanelMobile v-if="simulatorMobileStore.showMobileView" />
<PropertiesPanelMobile v-if="simulatorMobileStore.showMobileView" />
</template>
<script lang="ts" setup>
import VerilogEditorPanel from './Panels/VerilogEditorPanel/VerilogEditorPanel.vue'
import VerilogEditorPanelMobile from './Panels/VerilogEditorPanel/VerilogEditorPanelMobile.vue'
import ElementsPanel from './Panels/ElementsPanel/ElementsPanel.vue'
import PropertiesPanel from './Panels/PropertiesPanel/PropertiesPanel.vue'
import TimingDiagramPanel from './Panels/TimingDiagramPanel/TimingDiagramPanel.vue'
import TabsBar from './TabsBar/TabsBar.vue'
import CombinationalAnalysis from './DialogBox/CombinationalAnalysis.vue'
import HexBinDec from './DialogBox/HexBinDec.vue'
import SaveImage from './DialogBox/SaveImage.vue'
import ApplyThemes from './DialogBox/Themes/ApplyThemes.vue'
import ExportVerilog from './DialogBox/ExportVerilog.vue'
import CustomShortcut from './DialogBox/CustomShortcut.vue'
import InsertSubcircuit from './DialogBox/InsertSubcircuit.vue'
import OpenOffline from './DialogBox/OpenOffline.vue'
import ReportIssue from './ReportIssue/ReportIssue.vue'
import LayoutElementsPanel from './Panels/LayoutElementsPanel/LayoutElementsPanel.vue'
import TestBenchPanel from './Panels/TestBenchPanel/TestBenchPanel.vue'
import TestBenchCreator from './Panels/TestBenchPanel/TestBenchCreator.vue'
import TestBenchValidator from './Panels/TestBenchPanel/TestBenchValidator.vue'
import QuickButtonMobile from './Navbar/QuickButton/QuickButtonMobile.vue'
import TimingDiagramMobile from './Panels/TimingDiagramPanel/TimingDiagramMobile.vue'
import ElementsPanelMobile from './Panels/ElementsPanel/ElementsPanelMobile.vue'
import PropertiesPanelMobile from './Panels/PropertiesPanel/PropertiesPanelMobile.vue'
import { simulationArea } from '#/simulator/src/simulationArea'
import { paste } from '#/simulator/src/events'
import { panStart, panMove, panStop } from '#/simulator/src/listeners'
import { useSimulatorMobileStore } from '#/store/simulatorMobileStore'
import { useState } from '#/store/SimulatorStore/state'
import { reactive, ref, watch } from 'vue'
const simulatorMobileStore = useSimulatorMobileStore()
const selectMultiple = ref(false)
const propertiesPanelPos = reactive({
up: 22,
down: 14
});
const tooltip = reactive({
visible: false,
text: '',
x: 0,
y: 0,
})
watch(() => simulatorMobileStore.isVerilog, (val) => {
if (val) {
propertiesPanelPos.up = 10
propertiesPanelPos.down = 2
} else {
propertiesPanelPos.up = 22
propertiesPanelPos.down = 14
}
})
const copyBtnClick = () => {
window.document.execCommand('copy')
simulationArea.shiftDown = false
simulatorMobileStore.isCopy = true
}
const pasteBtnClick = () => {
paste(localStorage.getItem('clipboardData'));
simulatorMobileStore.isCopy = false
}
const propertiesBtnClick = () => {
simulatorMobileStore.showPropertiesPanel = !simulatorMobileStore.showPropertiesPanel
}
</script>
<style scoped>
.canvasArea {
position: relative;
}
.cir-ele-btn, .cir-verilog-btn {
position: absolute;
right: 1.5rem;
bottom: 15rem;
z-index: 90;
background-color: var(--bg-toggle-btn-primary);
color: white;
border-radius: 100%;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: 0.3s;
padding: 1rem;
height: 4rem;
width: 4rem;
}
.cir-verilog-btn {
bottom: 2rem;
}
.cir-btn{
position: absolute;
left: 1.5rem;
bottom: 2rem;
z-index: 90;
background-color: var(--bg-toggle-btn-primary);
color: white;
border-radius: 100%;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: 0.3s;
padding: 1rem;
height: 4rem;
width: 4rem;
}
</style>