1
1
<template >
2
+ <QuickButtonMobile v-if =" simulatorMobileStore.showQuickButtons && simulatorMobileStore.showMobileView" />
3
+ <TimingDiagramMobile v-if =" simulatorMobileStore.showMobileView" v-show =" simulatorMobileStore.showTimingDiagram" />
2
4
<!-- -------------------------------------------------------------------------------------------- - -->
3
5
<!-- TabsBar -->
4
6
<TabsBar />
11
13
12
14
<!-- -------------------------------------------------------------------------------------------- - -->
13
15
<!-- Circuit Elements Panel -->
14
- <ElementsPanel />
16
+ <ElementsPanel v-if = " !simulatorMobileStore.showMobileView " />
15
17
<!-- -------------------------------------------------------------------------------------------- - -->
16
18
17
19
<!-- -------------------------------------------------------------------------------------------- - -->
21
23
22
24
<!-- -------------------------------------------------------------------------------------------- - -->
23
25
<!-- Timing Diagram Panel -->
24
- <TimingDiagramPanel />
26
+ <TimingDiagramPanel v-if = " !simulatorMobileStore.showMobileView " />
25
27
<!-- -------------------------------------------------------------------------------------------- - -->
26
28
27
29
<!-- -------------------------------------------------------------------------------------------- - -->
28
30
<!-- Testbench -->
29
- <TestBenchPanel />
31
+ <TestBenchPanel v-if = " !simulatorMobileStore.showMobileView " />
30
32
<!-- -------------------------------------------------------------------------------------------- - -->
31
- <TestBenchCreator />
33
+ <TestBenchCreator v-if = " !simulatorMobileStore.showMobileView " />
32
34
<!-- -------------------------------------------------------------------------------------------- - -->
33
35
34
36
<!-- -------------------------------------------------------------------------------------------- - -->
41
43
42
44
<!-- -------------------------------------------------------------------------------------------- - -->
43
45
<!-- Verilog Editor Panel -->
44
- <VerilogEditorPanel />
46
+ <VerilogEditorPanel v-if =" !simulatorMobileStore.showMobileView" />
47
+
48
+ <div id =" code-window" class =" code-window" >
49
+ <textarea id =" codeTextArea" ></textarea >
50
+ </div >
51
+ <VerilogEditorPanelMobile v-if =" simulatorMobileStore.showMobileView && simulatorMobileStore.showVerilogPanel" />
45
52
<!-- -------------------------------------------------------------------------------------------- - -->
46
53
47
54
<!-- -------------------------------------------------------------------------------------------- - -->
48
55
<!-- Element Properties Panel -->
49
- <PropertiesPanel />
56
+ <PropertiesPanel v-if = " !simulatorMobileStore.showMobileView " />
50
57
<!-- -------------------------------------------------------------------------------------------- - -->
51
58
52
59
<!-- -------------------------------------------------------------------------------------------- - -->
86
93
width : 100% ;
87
94
height : 100% ;
88
95
" ></canvas >
89
- <canvas id =" simulationArea" style ="
96
+ <canvas
97
+ id =" simulationArea"
98
+ style ="
90
99
position : absolute ;
91
100
left : 0 ;
92
101
top : 0 ;
93
102
z-index : 1 ;
94
103
width : 100% ;
95
104
height : 100% ;
96
- " ></canvas >
105
+ "
106
+ @touchstart =" (e) => {
107
+ simulationArea.touch = true;
108
+ panStart(e)
109
+ }"
110
+ @touchend =" (e) => {
111
+ simulationArea.touch = true;
112
+ panStop(e)
113
+ }"
114
+ @touchmove =" (e) => {
115
+ simulationArea.touch = true;
116
+ panMove(e)
117
+ }"
118
+ @mousedown =" (e) => {
119
+ simulationArea.touch = false;
120
+ panStart(e)
121
+ }"
122
+ @mousemove =" (e) => {
123
+ simulationArea.touch = false;
124
+ panMove(e)
125
+ }"
126
+ @mouseup =" (e) => {
127
+ simulationArea.touch = false;
128
+ panStop(e)
129
+ }"
130
+ ></canvas >
97
131
<div id =" miniMap" >
98
132
<canvas id =" miniMapArea" style =" position : absolute ; left : 0 ; top : 0 ; z-index : 3 " ></canvas >
99
133
</div >
143
177
<!-- -issue reporting-system----->
144
178
<ReportIssue />
145
179
<!-- -------------------------------------------------------------------------------------------- - -->
180
+
181
+ <v-btn
182
+ class =" cir-ele-btn"
183
+ @mousedown =" simulatorMobileStore.showElementsPanel = !simulatorMobileStore.showElementsPanel"
184
+ :style =" {bottom: simulatorMobileStore.showElementsPanel ? '10rem' : '2rem'}"
185
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"
186
+ >
187
+ <i class =" fas fa-bezier-curve" ></i >
188
+ </v-btn >
189
+
190
+ <v-btn
191
+ class =" cir-btn"
192
+ @mousedown =" (e: React.MouseEvent) => {
193
+ if(simulationArea.shiftDown == false) {
194
+ simulationArea.shiftDown = true;
195
+ selectMultiple = true;
196
+ }
197
+ else {
198
+ simulationArea.shiftDown = false;
199
+ selectMultiple = false;
200
+ e.preventDefault();
201
+ }
202
+ }"
203
+ :style =" {bottom: simulatorMobileStore.showElementsPanel ? '10rem' : '2rem', backgroundColor: selectMultiple ? 'var(--primary)' : 'var(--bg-toggle-btn-primary)'}"
204
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"
205
+ >
206
+ <i class =" fa-solid fa-vector-square" ></i >
207
+ </v-btn >
208
+
209
+ <v-btn
210
+ class =" cir-verilog-btn"
211
+ @mousedown =" simulatorMobileStore.showVerilogPanel = !simulatorMobileStore.showVerilogPanel"
212
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.isVerilog && simulatorMobileStore.showMobileView"
213
+ >
214
+ <i class =" fa-solid fa-gears" ></i >
215
+ </v-btn >
216
+
217
+ <v-btn
218
+ class =" cir-btn"
219
+ @mousedown =" copyBtnClick()"
220
+ :style =" {bottom: simulatorMobileStore.showElementsPanel ? '16rem' : '8rem'}"
221
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && !simulatorMobileStore.isCopy && !simulatorMobileStore.isVerilog"
222
+ >
223
+ <i class =" fa-solid fa-copy" ></i >
224
+ </v-btn >
225
+
226
+ <v-btn
227
+ class =" cir-btn"
228
+ @mousedown =" pasteBtnClick()"
229
+ :style =" {bottom: simulatorMobileStore.showElementsPanel ? '16rem' : '8rem'}"
230
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView && simulatorMobileStore.isCopy && !simulatorMobileStore.isVerilog"
231
+ >
232
+ <i class =" fa-solid fa-paste" ></i >
233
+ </v-btn >
234
+
235
+ <v-btn
236
+ class =" cir-btn"
237
+ @mousedown =" propertiesBtnClick()"
238
+ :style =" {bottom: simulatorMobileStore.showElementsPanel ? `${propertiesPanelPos.up}rem` : `${propertiesPanelPos.down}rem`}"
239
+ v-if =" simulatorMobileStore.showMobileButtons && simulatorMobileStore.showMobileView"
240
+ >
241
+ <i class =" fa-solid fa-sliders" ></i >
242
+ </v-btn >
243
+
244
+ <ElementsPanelMobile v-if =" simulatorMobileStore.showMobileView" />
245
+ <PropertiesPanelMobile v-if =" simulatorMobileStore.showMobileView" />
146
246
</template >
147
247
148
248
<script lang="ts" setup>
149
249
import VerilogEditorPanel from ' ./Panels/VerilogEditorPanel/VerilogEditorPanel.vue'
250
+ import VerilogEditorPanelMobile from ' ./Panels/VerilogEditorPanel/VerilogEditorPanelMobile.vue'
150
251
import ElementsPanel from ' ./Panels/ElementsPanel/ElementsPanel.vue'
151
252
import PropertiesPanel from ' ./Panels/PropertiesPanel/PropertiesPanel.vue'
152
253
import TimingDiagramPanel from ' ./Panels/TimingDiagramPanel/TimingDiagramPanel.vue'
@@ -164,5 +265,90 @@ import LayoutElementsPanel from './Panels/LayoutElementsPanel/LayoutElementsPane
164
265
import TestBenchPanel from ' ./Panels/TestBenchPanel/TestBenchPanel.vue'
165
266
import TestBenchCreator from ' ./Panels/TestBenchPanel/TestBenchCreator.vue'
166
267
import TestBenchValidator from ' ./Panels/TestBenchPanel/TestBenchValidator.vue'
268
+ import QuickButtonMobile from ' ./Navbar/QuickButton/QuickButtonMobile.vue'
269
+ import TimingDiagramMobile from ' ./Panels/TimingDiagramPanel/TimingDiagramMobile.vue'
270
+ import ElementsPanelMobile from ' ./Panels/ElementsPanel/ElementsPanelMobile.vue'
271
+ import PropertiesPanelMobile from ' ./Panels/PropertiesPanel/PropertiesPanelMobile.vue'
272
+ import { simulationArea } from ' #/simulator/src/simulationArea'
273
+ import { paste } from ' #/simulator/src/events'
274
+ import { panStart , panMove , panStop } from ' #/simulator/src/listeners'
275
+ import { useSimulatorMobileStore } from ' #/store/simulatorMobileStore'
167
276
import { useState } from ' #/store/SimulatorStore/state'
168
- </script >
277
+ import { reactive , ref , watch } from ' vue'
278
+
279
+ const simulatorMobileStore = useSimulatorMobileStore ()
280
+ const selectMultiple = ref (false )
281
+ const propertiesPanelPos = reactive ({
282
+ up: 22 ,
283
+ down: 14
284
+ });
285
+
286
+ watch (() => simulatorMobileStore .isVerilog , (val ) => {
287
+ if (val ) {
288
+ propertiesPanelPos .up = 10
289
+ propertiesPanelPos .down = 2
290
+ } else {
291
+ propertiesPanelPos .up = 22
292
+ propertiesPanelPos .down = 14
293
+ }
294
+ })
295
+
296
+ const copyBtnClick = () => {
297
+ window .document .execCommand (' copy' )
298
+ simulationArea .shiftDown = false
299
+ simulatorMobileStore .isCopy = true
300
+ }
301
+
302
+ const pasteBtnClick = () => {
303
+ paste (localStorage .getItem (' clipboardData' ));
304
+ simulatorMobileStore .isCopy = false
305
+ }
306
+
307
+ const propertiesBtnClick = () => {
308
+ simulatorMobileStore .showPropertiesPanel = ! simulatorMobileStore .showPropertiesPanel
309
+ }
310
+ </script >
311
+
312
+ <style scoped>
313
+ .cir-ele-btn , .cir-verilog-btn {
314
+ position : absolute ;
315
+ right : 1.5rem ;
316
+ bottom : 15rem ;
317
+ z-index : 90 ;
318
+ background-color : var (--bg-toggle-btn-primary );
319
+ color : white ;
320
+ border-radius : 100% ;
321
+ font-size : 20px ;
322
+ display : flex ;
323
+ justify-content : center ;
324
+ align-items : center ;
325
+ cursor : pointer ;
326
+ transition : 0.3s ;
327
+ padding : 1rem ;
328
+ height : 4rem ;
329
+ width : 4rem ;
330
+ }
331
+
332
+ .cir-verilog-btn {
333
+ bottom : 2rem ;
334
+ }
335
+
336
+ .cir-btn {
337
+ position : absolute ;
338
+ left : 1.5rem ;
339
+ bottom : 2rem ;
340
+ z-index : 90 ;
341
+ background-color : var (--bg-toggle-btn-primary );
342
+ color : white ;
343
+ border-radius : 100% ;
344
+ font-size : 20px ;
345
+ display : flex ;
346
+ justify-content : center ;
347
+ align-items : center ;
348
+ cursor : pointer ;
349
+ transition : 0.3s ;
350
+ padding : 1rem ;
351
+ height : 4rem ;
352
+ width : 4rem ;
353
+ }
354
+ </style >
0 commit comments