Skip to content

Commit b3f67fa

Browse files
committed
Improved event handling especially for touch
1 parent 3b35903 commit b3f67fa

File tree

10 files changed

+503
-302
lines changed

10 files changed

+503
-302
lines changed

simulator/css/LogicEditor.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ svg text {
586586
visibility: hidden;
587587
justify-content: center;
588588
align-items: center;
589-
transition: all 0.15s ease-in-out
589+
transition: all 0.15s ease-in-out;
590+
pointer-events: none;
590591
}
591592

592593
.msgZone.visible {
@@ -602,6 +603,7 @@ svg text {
602603
box-shadow: 0px 0px 5px 0px rgba(128, 128, 128, 0.5);
603604
font-size: 10pt;
604605
background-color: rgb(190, 190, 190, 0.2);
606+
pointer-events: auto;
605607
}
606608

607609
.dark .msgZone .msgBar {

simulator/src/ComponentFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class ComponentFactory {
415415
customComp.setSpawned()
416416
customComp.setPosition(editor.pointerX + customComp.unrotatedWidth / 2 - 5, editor.pointerY, true)
417417
editor.eventMgr.currentSelection = undefined
418-
editor.eventMgr.setCurrentPointerOverComp(customComp)
418+
editor.eventMgr.setCurrentComponentUnderPointer(customComp)
419419

420420
for (const comp of componentsToInclude) {
421421
editor.components.tryDelete(comp)

simulator/src/LogicEditor.ts

Lines changed: 100 additions & 48 deletions
Large diffs are not rendered by default.

simulator/src/TopBar.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ export class TopBar {
178178

179179
this.setDirty(false)
180180

181-
window.addEventListener("resize", this.updateCompactMode.bind(this))
182-
183181
this.setEditingCustomComponent(undefined)
184182
this.setCircuitName(editor.documentDisplayName)
185183
this.updateCompactMode()
@@ -236,13 +234,16 @@ export class TopBar {
236234

237235
private zoomLevelHandler() {
238236
const zoom = this.zoomLevelInput.valueAsNumber
239-
this.editor.setZoomLevel(zoom)
237+
const validatedZoom = this.editor.setZoom(zoom, false)
238+
if (validatedZoom !== zoom) {
239+
this.setZoom(validatedZoom)
240+
}
240241
}
241242

242243

243244
// Visibility methods
244245

245-
private updateCompactMode() {
246+
public updateCompactMode() {
246247
const getSepWidth = () => this.flexibleSep.getBoundingClientRect().width
247248
const MinSepWidth = 5
248249
const sepWidth = getSepWidth()
@@ -315,7 +316,7 @@ export class TopBar {
315316
this.updateCompactMode()
316317
}
317318

318-
public setZoomLevel(zoom: number) {
319+
public setZoom(zoom: number) {
319320
this.zoomLevelInput.value = String(zoom)
320321
}
321322

0 commit comments

Comments
 (0)