Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Fix: two-finger pinch no longer breaks selection on mobile Safari

nyblnet43d14be193f2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43e6a75a..91c16c59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,20 @@ below opens files from every earlier version, and unknown fields are preserved.
This project's versions roughly follow semantic-ish `0.MINOR.PATCH` while it is
pre-1.0.
+## [Unreleased]
+
+- **Fix: charts with negative values now baseline at zero.** A bar/line chart
+ whose data crosses zero drew everything from the bottom of the plot — negative
+ bars pointed up and the x-axis was pinned to the floor. Bars now grow from the
+ zero line (positive up, negative down), and the x-axis line sits at zero so
+ values dip below it. All-positive charts are unchanged.
+
+- **Fix: two-finger pinch no longer breaks selection on mobile Safari.** A pinch
+ over the canvas started a rubber-band marquee and, combined with the page
+ zoom, threw the selection box off and could crash the page. Multi-touch
+ gestures are now ignored by the marquee and the page pinch-zoom is suppressed
+ over the canvas; single-touch scroll and selection are unaffected.
+
## [1.0.7] — 2026-07-22
- **In-place update keeps its handle.** When a deck opened *without* a File
diff --git a/slides/src/editor/canvas.ts b/slides/src/editor/canvas.ts
index 8ebc262c..5fccd66e 100644
--- a/slides/src/editor/canvas.ts
+++ b/slides/src/editor/canvas.ts
@@ -107,6 +107,13 @@ export class SlideCanvas {
selectByClick: true,
selectFromInside: false,
toggleContinueSelect: 'shift',
+ // A two-finger pinch (mobile Safari) must not start a marquee — it throws
+ // off the selection box and has crashed the page. Only single-touch drags
+ // rubber-band; the browser keeps its own gesture.
+ dragCondition: (e) => {
+ const touches = (e?.inputEvent as TouchEvent | undefined)?.touches
+ return !touches || touches.length <= 1
+ },
// Marquee selects only elements it fully contains (clicking still
// selects whatever is under the cursor via selectByClick).
hitRate: 100,
@@ -115,6 +122,15 @@ export class SlideCanvas {
this.wireMoveable()
this.wireSelecto()
+ // Mobile Safari: a two-finger pinch over the canvas zooms the PAGE, which
+ // (mid-marquee) throws Selecto's coordinates off and has crashed the page.
+ // Swallow multi-touch gestures on the canvas — the editor has its own zoom,
+ // and page-pinch-zooming an editor surface is never what you want. Single
+ // touch (scroll / marquee) is untouched. Non-passive so preventDefault works.
+ const swallowPinch = (ev: TouchEvent) => { if (ev.touches.length > 1) ev.preventDefault() }
+ this.scroller.addEventListener('touchstart', swallowPinch, { passive: false })
+ this.scroller.addEventListener('touchmove', swallowPinch, { passive: false })
+
// Pin the scroller during Moveable gestures: snap guidelines can overflow
// the stage and grow the scroll area, which made the slide jump around
// mid-drag. Any scroll while a gesture is live is snapped straight back.