@tldraw/editor 5.2.5 → 5.3.0-canary.00f14de1f81d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +76 -10
- package/dist-cjs/index.js +3 -3
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +6 -1
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +67 -15
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EditorManager.js +52 -0
- package/dist-cjs/lib/editor/managers/EditorManager.js.map +7 -0
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +9 -11
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +9 -0
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +5 -9
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js +18 -29
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +96 -54
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +27 -19
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +4 -7
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +3 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +1 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
- package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/license/LicenseManager.js +14 -5
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/options.js +2 -1
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +76 -10
- package/dist-esm/index.mjs +3 -3
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +6 -1
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +67 -15
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EditorManager.mjs +32 -0
- package/dist-esm/lib/editor/managers/EditorManager.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +9 -11
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +9 -0
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +5 -9
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs +18 -29
- package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +103 -56
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +27 -19
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +4 -7
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +3 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +1 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +14 -5
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +2 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +10 -0
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/lib/TldrawEditor.tsx +10 -1
- package/src/lib/editor/Editor.ts +101 -20
- package/src/lib/editor/managers/EditorManager.test.ts +51 -0
- package/src/lib/editor/managers/EditorManager.ts +60 -0
- package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +2 -1
- package/src/lib/editor/managers/FocusManager/FocusManager.ts +10 -14
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +66 -0
- package/src/lib/editor/managers/FontManager/FontManager.ts +14 -0
- package/src/lib/editor/managers/InputsManager/InputsManager.ts +6 -9
- package/src/lib/editor/managers/SpatialIndexManager/RBushIndex.ts +19 -33
- package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +173 -86
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +61 -1
- package/src/lib/editor/managers/TextManager/TextManager.ts +36 -19
- package/src/lib/editor/managers/TickManager/TickManager.test.ts +0 -10
- package/src/lib/editor/managers/TickManager/TickManager.ts +5 -6
- package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +6 -1
- package/src/lib/editor/shapes/ShapeUtil.ts +1 -0
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +2 -2
- package/src/lib/editor/types/emit-types.ts +1 -0
- package/src/lib/license/LicenseManager.test.ts +99 -29
- package/src/lib/license/LicenseManager.ts +16 -4
- package/src/lib/options.ts +3 -1
- package/src/version.ts +3 -3
- package/dist-cjs/lib/editor/tools/cancelShapeCreationOnLongPress.js +0 -28
- package/dist-cjs/lib/editor/tools/cancelShapeCreationOnLongPress.js.map +0 -7
- package/dist-esm/lib/editor/tools/cancelShapeCreationOnLongPress.mjs +0 -8
- package/dist-esm/lib/editor/tools/cancelShapeCreationOnLongPress.mjs.map +0 -7
- package/src/lib/editor/tools/cancelShapeCreationOnLongPress.ts +0 -31
|
@@ -510,6 +510,60 @@ describe('LicenseManager', () => {
|
|
|
510
510
|
})
|
|
511
511
|
})
|
|
512
512
|
|
|
513
|
+
describe('Expiry date timezone handling', () => {
|
|
514
|
+
afterEach(() => {
|
|
515
|
+
vi.useRealTimers()
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
// The named expiry date is minted as a date-only string and should mean "the license
|
|
519
|
+
// is fully usable through the end of that day in UTC", giving every user the same
|
|
520
|
+
// cutoff regardless of their local timezone.
|
|
521
|
+
async function makeEvaluationLicenseWithExpiry(expiry: string) {
|
|
522
|
+
const licenseInfo = JSON.parse(STANDARD_LICENSE_INFO)
|
|
523
|
+
licenseInfo[PROPERTIES.FLAGS] = FLAGS.EVALUATION_LICENSE
|
|
524
|
+
licenseInfo[PROPERTIES.EXPIRY_DATE] = expiry
|
|
525
|
+
return generateLicenseKey(JSON.stringify(licenseInfo), keyPair)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
it('Keeps the license valid through the end of the named expiry day (UTC)', async () => {
|
|
529
|
+
const key = await makeEvaluationLicenseWithExpiry('2026-06-26')
|
|
530
|
+
|
|
531
|
+
// The final moment of the named day is still valid.
|
|
532
|
+
vi.useFakeTimers()
|
|
533
|
+
vi.setSystemTime(new Date('2026-06-26T23:59:59.000Z'))
|
|
534
|
+
expect(
|
|
535
|
+
((await licenseManager.getLicenseFromKey(key)) as ValidLicenseKeyResult)
|
|
536
|
+
.isEvaluationLicenseExpired
|
|
537
|
+
).toBe(false)
|
|
538
|
+
})
|
|
539
|
+
|
|
540
|
+
it('Expires the license at the start of the day after the named expiry day (UTC)', async () => {
|
|
541
|
+
const key = await makeEvaluationLicenseWithExpiry('2026-06-26')
|
|
542
|
+
|
|
543
|
+
vi.useFakeTimers()
|
|
544
|
+
vi.setSystemTime(new Date('2026-06-27T00:00:01.000Z'))
|
|
545
|
+
expect(
|
|
546
|
+
((await licenseManager.getLicenseFromKey(key)) as ValidLicenseKeyResult)
|
|
547
|
+
.isEvaluationLicenseExpired
|
|
548
|
+
).toBe(true)
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
it('Does not expire early for users west of UTC who are still on the named day locally', async () => {
|
|
552
|
+
const key = await makeEvaluationLicenseWithExpiry('2026-06-26')
|
|
553
|
+
|
|
554
|
+
// Under the old logic a user west of UTC parsed the date one calendar day early and
|
|
555
|
+
// expired at the *start* of that day, losing most of a day. With the uniform UTC
|
|
556
|
+
// cutoff the license stays valid all through June 26 for everyone, no matter their
|
|
557
|
+
// local offset. 1pm UTC on June 26 is well before the cutoff, so it is still valid.
|
|
558
|
+
vi.useFakeTimers()
|
|
559
|
+
vi.setSystemTime(new Date('2026-06-26T13:00:00.000Z'))
|
|
560
|
+
expect(
|
|
561
|
+
((await licenseManager.getLicenseFromKey(key)) as ValidLicenseKeyResult)
|
|
562
|
+
.isEvaluationLicenseExpired
|
|
563
|
+
).toBe(false)
|
|
564
|
+
})
|
|
565
|
+
})
|
|
566
|
+
|
|
513
567
|
describe('License expiry and grace period', () => {
|
|
514
568
|
it('Fails if the license key has expired beyond grace period', async () => {
|
|
515
569
|
const expiredLicenseInfo = JSON.parse(STANDARD_LICENSE_INFO)
|
|
@@ -540,38 +594,54 @@ describe('LicenseManager', () => {
|
|
|
540
594
|
})
|
|
541
595
|
|
|
542
596
|
it('Handles grace period correctly - 20 days expired should still be within grace period', async () => {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
597
|
+
// Pin the clock and use a date-only UTC expiry so the calculation is timezone
|
|
598
|
+
// independent. The named day is fully usable, so an expiry 20 calendar days before
|
|
599
|
+
// "now" has been past its usable window for 19 full days.
|
|
600
|
+
vi.useFakeTimers()
|
|
601
|
+
vi.setSystemTime(new Date('2026-06-26T12:00:00.000Z'))
|
|
602
|
+
try {
|
|
603
|
+
const expiredLicenseInfo = JSON.parse(STANDARD_LICENSE_INFO)
|
|
604
|
+
expiredLicenseInfo[PROPERTIES.EXPIRY_DATE] = '2026-06-06' // 20 days before now
|
|
605
|
+
|
|
606
|
+
const expiredLicenseKey = await generateLicenseKey(
|
|
607
|
+
JSON.stringify(expiredLicenseInfo),
|
|
608
|
+
keyPair
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
// Test the getLicenseFromKey method to verify grace period calculation
|
|
612
|
+
const result = (await licenseManager.getLicenseFromKey(
|
|
613
|
+
expiredLicenseKey
|
|
614
|
+
)) as ValidLicenseKeyResult
|
|
615
|
+
expect(result.isAnnualLicense).toBe(true)
|
|
616
|
+
expect(result.isAnnualLicenseExpired).toBe(false) // Within 30-day grace period
|
|
617
|
+
expect(result.daysSinceExpiry).toBe(19)
|
|
618
|
+
} finally {
|
|
619
|
+
vi.useRealTimers()
|
|
620
|
+
}
|
|
559
621
|
})
|
|
560
622
|
|
|
561
623
|
it('Calculates days since expiry correctly', async () => {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
624
|
+
// Pin the clock and use a date-only UTC expiry so the calculation is timezone
|
|
625
|
+
// independent. The named day is fully usable, so an expiry 15 calendar days before
|
|
626
|
+
// "now" has been past its usable window for 14 full days.
|
|
627
|
+
vi.useFakeTimers()
|
|
628
|
+
vi.setSystemTime(new Date('2026-06-26T12:00:00.000Z'))
|
|
629
|
+
try {
|
|
630
|
+
const expiredLicenseInfo = JSON.parse(STANDARD_LICENSE_INFO)
|
|
631
|
+
expiredLicenseInfo[PROPERTIES.EXPIRY_DATE] = '2026-06-11' // 15 days before now
|
|
632
|
+
|
|
633
|
+
const expiredLicenseKey = await generateLicenseKey(
|
|
634
|
+
JSON.stringify(expiredLicenseInfo),
|
|
635
|
+
keyPair
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
const result = (await licenseManager.getLicenseFromKey(
|
|
639
|
+
expiredLicenseKey
|
|
640
|
+
)) as ValidLicenseKeyResult
|
|
641
|
+
expect(result.daysSinceExpiry).toBe(14)
|
|
642
|
+
} finally {
|
|
643
|
+
vi.useRealTimers()
|
|
644
|
+
}
|
|
575
645
|
})
|
|
576
646
|
})
|
|
577
647
|
|
|
@@ -372,14 +372,26 @@ export class LicenseManager {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
private getExpirationDateWithoutGracePeriod(expiryDate: Date) {
|
|
375
|
-
|
|
375
|
+
// The named expiry date is the last day the license is fully usable, so the license
|
|
376
|
+
// expires at the end of that day, i.e. the start of the following day. We work in UTC
|
|
377
|
+
// (the expiry date is minted and parsed as a UTC date-only string) so the cutoff is a
|
|
378
|
+
// single predictable instant for every user regardless of their local timezone.
|
|
379
|
+
return new Date(
|
|
380
|
+
Date.UTC(
|
|
381
|
+
expiryDate.getUTCFullYear(),
|
|
382
|
+
expiryDate.getUTCMonth(),
|
|
383
|
+
expiryDate.getUTCDate() + 1 // Add 1 day so the named date is fully usable
|
|
384
|
+
)
|
|
385
|
+
)
|
|
376
386
|
}
|
|
377
387
|
|
|
378
388
|
private getExpirationDateWithGracePeriod(expiryDate: Date) {
|
|
379
389
|
return new Date(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
390
|
+
Date.UTC(
|
|
391
|
+
expiryDate.getUTCFullYear(),
|
|
392
|
+
expiryDate.getUTCMonth(),
|
|
393
|
+
expiryDate.getUTCDate() + GRACE_PERIOD_DAYS + 1 // Add 1 day to include the expiration day
|
|
394
|
+
)
|
|
383
395
|
)
|
|
384
396
|
}
|
|
385
397
|
|
package/src/lib/options.ts
CHANGED
|
@@ -86,6 +86,7 @@ export interface TldrawOptions {
|
|
|
86
86
|
readonly collaboratorCheckIntervalMs: number
|
|
87
87
|
readonly cameraMovingTimeoutMs: number
|
|
88
88
|
readonly hitTestMargin: number
|
|
89
|
+
readonly coarseHitTestMargin: number
|
|
89
90
|
readonly edgeScrollDelay: number
|
|
90
91
|
readonly edgeScrollEaseDuration: number
|
|
91
92
|
readonly edgeScrollSpeed: number
|
|
@@ -312,7 +313,8 @@ export const defaultTldrawOptions = {
|
|
|
312
313
|
collaboratorIdleTimeoutMs: 3000,
|
|
313
314
|
collaboratorCheckIntervalMs: 1200,
|
|
314
315
|
cameraMovingTimeoutMs: 64,
|
|
315
|
-
hitTestMargin:
|
|
316
|
+
hitTestMargin: 3,
|
|
317
|
+
coarseHitTestMargin: 4,
|
|
316
318
|
edgeScrollDelay: 200,
|
|
317
319
|
edgeScrollEaseDuration: 200,
|
|
318
320
|
edgeScrollSpeed: 25,
|
package/src/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '5.
|
|
4
|
+
export const version = '5.3.0-canary.00f14de1f81d'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2026-05-06T16:28:18.473Z',
|
|
7
|
-
minor: '2026-07-
|
|
8
|
-
patch: '2026-07-
|
|
7
|
+
minor: '2026-07-17T13:34:29.251Z',
|
|
8
|
+
patch: '2026-07-17T13:34:29.251Z',
|
|
9
9
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cancelShapeCreationOnLongPress_exports = {};
|
|
20
|
-
__export(cancelShapeCreationOnLongPress_exports, {
|
|
21
|
-
cancelShapeCreationOnLongPress: () => cancelShapeCreationOnLongPress
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(cancelShapeCreationOnLongPress_exports);
|
|
24
|
-
function cancelShapeCreationOnLongPress(editor, cancelPendingCreation) {
|
|
25
|
-
if (!editor.getInstanceState().isCoarsePointer) return;
|
|
26
|
-
cancelPendingCreation();
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=cancelShapeCreationOnLongPress.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/editor/tools/cancelShapeCreationOnLongPress.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Editor } from '../Editor'\n\n/**\n * Shared handler for a long-press in a discrete shape-creation tool's pointing\n * state (geo, note, line, text, arrow, frame). On a coarse pointer this cancels\n * any pending creation so the long-press leaves no shape behind (issue #8277).\n * It does not open a context menu \u2014 that is a select-tool surface, reached on\n * touch only from the select tool, and on desktop from a right-click (which the\n * editor routes through the select tool).\n *\n * Gated on `isCoarsePointer`: on a fine pointer (mouse) the long-press timer\n * powers the deliberate \"pause before drag to start a precise arrow\" gesture,\n * which we must not disturb. The bug only manifests on coarse pointers, because\n * that is also where the browser fires `contextmenu` at the long-press mark.\n *\n * The `cancelPendingCreation` callback is the tool's own cleanup \u2014 it knows\n * whether it needs to `bailToMark` a shape it created early or simply transition\n * back to idle. Continuous-gesture tools (draw, highlight, eraser, laser) are\n * excluded: their press is their own action, so they handle (or ignore) the\n * long-press themselves.\n *\n * @internal\n */\nexport function cancelShapeCreationOnLongPress(\n\teditor: Editor,\n\tcancelPendingCreation: () => void\n): void {\n\tif (!editor.getInstanceState().isCoarsePointer) return\n\n\tcancelPendingCreation()\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,+BACf,QACA,uBACO;AACP,MAAI,CAAC,OAAO,iBAAiB,EAAE,gBAAiB;AAEhD,wBAAsB;AACvB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
function cancelShapeCreationOnLongPress(editor, cancelPendingCreation) {
|
|
2
|
-
if (!editor.getInstanceState().isCoarsePointer) return;
|
|
3
|
-
cancelPendingCreation();
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
cancelShapeCreationOnLongPress
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=cancelShapeCreationOnLongPress.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/editor/tools/cancelShapeCreationOnLongPress.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Editor } from '../Editor'\n\n/**\n * Shared handler for a long-press in a discrete shape-creation tool's pointing\n * state (geo, note, line, text, arrow, frame). On a coarse pointer this cancels\n * any pending creation so the long-press leaves no shape behind (issue #8277).\n * It does not open a context menu \u2014 that is a select-tool surface, reached on\n * touch only from the select tool, and on desktop from a right-click (which the\n * editor routes through the select tool).\n *\n * Gated on `isCoarsePointer`: on a fine pointer (mouse) the long-press timer\n * powers the deliberate \"pause before drag to start a precise arrow\" gesture,\n * which we must not disturb. The bug only manifests on coarse pointers, because\n * that is also where the browser fires `contextmenu` at the long-press mark.\n *\n * The `cancelPendingCreation` callback is the tool's own cleanup \u2014 it knows\n * whether it needs to `bailToMark` a shape it created early or simply transition\n * back to idle. Continuous-gesture tools (draw, highlight, eraser, laser) are\n * excluded: their press is their own action, so they handle (or ignore) the\n * long-press themselves.\n *\n * @internal\n */\nexport function cancelShapeCreationOnLongPress(\n\teditor: Editor,\n\tcancelPendingCreation: () => void\n): void {\n\tif (!editor.getInstanceState().isCoarsePointer) return\n\n\tcancelPendingCreation()\n}\n"],
|
|
5
|
-
"mappings": "AAuBO,SAAS,+BACf,QACA,uBACO;AACP,MAAI,CAAC,OAAO,iBAAiB,EAAE,gBAAiB;AAEhD,wBAAsB;AACvB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '../Editor'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Shared handler for a long-press in a discrete shape-creation tool's pointing
|
|
5
|
-
* state (geo, note, line, text, arrow, frame). On a coarse pointer this cancels
|
|
6
|
-
* any pending creation so the long-press leaves no shape behind (issue #8277).
|
|
7
|
-
* It does not open a context menu — that is a select-tool surface, reached on
|
|
8
|
-
* touch only from the select tool, and on desktop from a right-click (which the
|
|
9
|
-
* editor routes through the select tool).
|
|
10
|
-
*
|
|
11
|
-
* Gated on `isCoarsePointer`: on a fine pointer (mouse) the long-press timer
|
|
12
|
-
* powers the deliberate "pause before drag to start a precise arrow" gesture,
|
|
13
|
-
* which we must not disturb. The bug only manifests on coarse pointers, because
|
|
14
|
-
* that is also where the browser fires `contextmenu` at the long-press mark.
|
|
15
|
-
*
|
|
16
|
-
* The `cancelPendingCreation` callback is the tool's own cleanup — it knows
|
|
17
|
-
* whether it needs to `bailToMark` a shape it created early or simply transition
|
|
18
|
-
* back to idle. Continuous-gesture tools (draw, highlight, eraser, laser) are
|
|
19
|
-
* excluded: their press is their own action, so they handle (or ignore) the
|
|
20
|
-
* long-press themselves.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export function cancelShapeCreationOnLongPress(
|
|
25
|
-
editor: Editor,
|
|
26
|
-
cancelPendingCreation: () => void
|
|
27
|
-
): void {
|
|
28
|
-
if (!editor.getInstanceState().isCoarsePointer) return
|
|
29
|
-
|
|
30
|
-
cancelPendingCreation()
|
|
31
|
-
}
|