Skip to content
Open
Changes from all commits
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
118 changes: 84 additions & 34 deletions src/components/Extra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,40 +94,75 @@
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>
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)

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>
Expand Down Expand Up @@ -180,6 +215,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 +225,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 +253,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 +263,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 +273,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 +323,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 +357,9 @@ const propertiesBtnClick = () => {
</script>

<style scoped>
.canvasArea {
position: relative;
}
.cir-ele-btn, .cir-verilog-btn {
position: absolute;
right: 1.5rem;
Expand Down
Loading