Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 91 additions & 35 deletions src/components/Extra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,82 @@
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)
}"
@mouseup="(e) => {
simulationArea.touch = false;
panStop(e)
}"
></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;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}"


@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>
Expand Down Expand Up @@ -180,6 +221,7 @@

<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"
Expand All @@ -189,6 +231,7 @@

<v-btn
class="cir-btn"
title="Multi-select"
@mousedown="(e: React.MouseEvent) => {
if(simulationArea.shiftDown == false) {
simulationArea.shiftDown = true;
Expand Down Expand Up @@ -216,6 +259,7 @@

<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"
Expand All @@ -225,6 +269,7 @@

<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"
Expand All @@ -234,6 +279,7 @@

<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"
Expand Down Expand Up @@ -283,6 +329,13 @@ const propertiesPanelPos = reactive({
down: 14
});

const tooltip = reactive({
visible: false,
text: '',
x: 0,
y: 0,
})

watch(() => simulatorMobileStore.isVerilog, (val) => {
if (val) {
propertiesPanelPos.up = 10
Expand Down Expand Up @@ -310,6 +363,9 @@ const propertiesBtnClick = () => {
</script>

<style scoped>
.canvasArea {
position: relative;
}
.cir-ele-btn, .cir-verilog-btn {
position: absolute;
right: 1.5rem;
Expand Down
146 changes: 78 additions & 68 deletions src/simulator/src/listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import { verilogModeGet } from './Verilog2CV'
import { setupTimingListeners } from './plotArea'
import logixFunction from './data'
import { listen } from '@tauri-apps/api/event'

import { useSimulatorMobileStore } from '#/store/simulatorMobileStore'
import { toRefs } from 'vue'

Expand Down Expand Up @@ -788,92 +788,102 @@
});
}

// Desktop App Listeners
// Desktop App Listeners (Tauri)
// In web mode (npm run dev), @tauri-apps/api is not available, so we must guard these.

listen('new-project', () => {
logixFunction.newProject();
});
function initDesktopAppListeners() {
// if not running inside Tauri, do nothing
if (!window.__TAURI__ || typeof listen !== 'function') return

listen('save-online', () => {
logixFunction.save();
});
listen('new-project', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.newProject();
});

listen('save-offline', () => {
logixFunction.saveOffline();
});
listen('save-online', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.save();
});

listen('open-offline', () => {
logixFunction.createOpenLocalPrompt();
});
listen('save-offline', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.saveOffline();
});

listen('export', () => {
logixFunction.ExportProject();
});
listen('open-offline', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.createOpenLocalPrompt();
});

listen('import', () => {
logixFunction.ImportProject();
});
listen('export', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.ExportProject();
});

listen('recover', () => {
logixFunction.recoverProject();
});
listen('import', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.ImportProject();
});

listen('clear', () => {
logixFunction.clearProject();
});
listen('recover', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.recoverProject();
});

listen('preview-circuit', () => {
logixFunction.fullViewOption();
});
listen('clear', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.clearProject();
});

listen('new-circuit', () => {
logixFunction.createNewCircuitScope();
});
listen('preview-circuit', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.fullViewOption();
});

listen('new-verilog-module', () => {
logixFunction.newVerilogModule();
});
listen('new-circuit', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.createNewCircuitScope();
});

listen('insert-sub-circuit', () => {
logixFunction.createSubCircuitPrompt();
});
listen('new-verilog-module', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.newVerilogModule();
});

listen('combinational-analysis', () => {
logixFunction.createCombinationalAnalysisPrompt();
});
listen('insert-sub-circuit', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.createSubCircuitPrompt();
});

listen('hex-bin-dec', () => {
logixFunction.bitconverter();
});
listen('combinational-analysis', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.createCombinationalAnalysisPrompt();
});

listen('download-image', () => {
logixFunction.createSaveAsImgPrompt();
});
listen('hex-bin-dec', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.bitconverter();
});

listen('themes', () => {
logixFunction.colorThemes();
});
listen('download-image', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.createSaveAsImgPrompt();
});

listen('custom-shortcut', () => {
logixFunction.customShortcut();
});
listen('themes', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.colorThemes();
});

listen('export-verilog', () => {
logixFunction.generateVerilog();
});
listen('custom-shortcut', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.customShortcut();
});

listen('tutorial', () => {
logixFunction.showTourGuide();
});
listen('export-verilog', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.generateVerilog();
});

listen('tutorial', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.showTourGuide();
});

listen('user-manual', () => {
logixFunction.showUserManual();
});
listen('user-manual', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.showUserManual();
});

listen('learn-digital-circuit', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.showDigitalCircuit();
});

listen('discussion-forum', () => {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'listen' is not defined.
logixFunction.showDiscussionForum();
});
}

listen('learn-digital-circuit', () => {
logixFunction.showDigitalCircuit();
});
// call it once
initDesktopAppListeners()
Comment thread
Teesta-Mukherjee marked this conversation as resolved.
Outdated

listen('discussion-forum', () => {
logixFunction.showDiscussionForum();
});
Loading