@tldraw/editor 5.3.0-canary.ec4b74d7eb64 → 5.3.0-canary.fa3355c81e86
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 +14 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +10 -3
- package/dist-cjs/lib/editor/Editor.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/TextManager/TextManager.js +3 -0
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- 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 +14 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +10 -3
- package/dist-esm/lib/editor/Editor.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/TextManager/TextManager.mjs +3 -0
- package/dist-esm/lib/editor/managers/TextManager/TextManager.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/lib/editor/Editor.ts +18 -3
- 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/TextManager/TextManager.ts +3 -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/index.d.ts
CHANGED
|
@@ -1007,6 +1007,7 @@ export declare const defaultTldrawOptions: {
|
|
|
1007
1007
|
readonly cameraSlideFriction: 0.09;
|
|
1008
1008
|
readonly coarseDragDistanceSquared: 36;
|
|
1009
1009
|
readonly coarseHandleRadius: 20;
|
|
1010
|
+
readonly coarseHitTestMargin: 4;
|
|
1010
1011
|
readonly coarsePointerWidth: 12;
|
|
1011
1012
|
readonly collaboratorCheckIntervalMs: 1200;
|
|
1012
1013
|
readonly collaboratorIdleTimeoutMs: 3000;
|
|
@@ -1046,7 +1047,7 @@ export declare const defaultTldrawOptions: {
|
|
|
1046
1047
|
readonly step: 1;
|
|
1047
1048
|
}];
|
|
1048
1049
|
readonly handleRadius: 12;
|
|
1049
|
-
readonly hitTestMargin:
|
|
1050
|
+
readonly hitTestMargin: 3;
|
|
1050
1051
|
readonly laserDelayMs: 1200;
|
|
1051
1052
|
readonly laserFadeoutMs: 500;
|
|
1052
1053
|
readonly longPressDurationMs: 500;
|
|
@@ -3101,6 +3102,17 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3101
3102
|
* @public
|
|
3102
3103
|
*/
|
|
3103
3104
|
getCurrentPageBounds(): Box | undefined;
|
|
3105
|
+
/**
|
|
3106
|
+
* Get the hit-test margin in page space—the distance in page units within which a pointer is
|
|
3107
|
+
* considered to be touching a shape. This resolves to {@link TldrawOptions.hitTestMargin} (or
|
|
3108
|
+
* {@link TldrawOptions.coarseHitTestMargin} when using a coarse pointer) divided by the current
|
|
3109
|
+
* zoom level, so it stays a constant distance in screen space.
|
|
3110
|
+
*
|
|
3111
|
+
* @returns The hit-test margin in page space.
|
|
3112
|
+
*
|
|
3113
|
+
* @public
|
|
3114
|
+
*/
|
|
3115
|
+
getHitTestMargin(): number;
|
|
3104
3116
|
/**
|
|
3105
3117
|
* Get the top-most selected shape at the given point, ignoring groups.
|
|
3106
3118
|
*
|
|
@@ -8047,6 +8059,7 @@ export declare interface TldrawOptions {
|
|
|
8047
8059
|
readonly collaboratorCheckIntervalMs: number;
|
|
8048
8060
|
readonly cameraMovingTimeoutMs: number;
|
|
8049
8061
|
readonly hitTestMargin: number;
|
|
8062
|
+
readonly coarseHitTestMargin: number;
|
|
8050
8063
|
readonly edgeScrollDelay: number;
|
|
8051
8064
|
readonly edgeScrollEaseDuration: number;
|
|
8052
8065
|
readonly edgeScrollSpeed: number;
|
package/dist-cjs/index.js
CHANGED
|
@@ -379,7 +379,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
379
379
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
380
380
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
381
381
|
"@tldraw/editor",
|
|
382
|
-
"5.3.0-canary.
|
|
382
|
+
"5.3.0-canary.fa3355c81e86",
|
|
383
383
|
"cjs"
|
|
384
384
|
);
|
|
385
385
|
//# sourceMappingURL=index.js.map
|
|
@@ -4243,6 +4243,11 @@ class Editor extends import_eventemitter3.default {
|
|
|
4243
4243
|
});
|
|
4244
4244
|
return commonBounds;
|
|
4245
4245
|
}
|
|
4246
|
+
getHitTestMargin() {
|
|
4247
|
+
const { hitTestMargin, coarseHitTestMargin } = this.options;
|
|
4248
|
+
const margin = this.getInstanceState().isCoarsePointer ? coarseHitTestMargin : hitTestMargin;
|
|
4249
|
+
return margin / this.getZoomLevel();
|
|
4250
|
+
}
|
|
4246
4251
|
/**
|
|
4247
4252
|
* Get the top-most selected shape at the given point, ignoring groups.
|
|
4248
4253
|
*
|
|
@@ -4277,7 +4282,6 @@ class Editor extends import_eventemitter3.default {
|
|
|
4277
4282
|
* @returns The shape at the given point, or undefined if there is no shape at the point.
|
|
4278
4283
|
*/
|
|
4279
4284
|
getShapeAtPoint(point, opts = {}) {
|
|
4280
|
-
const zoomLevel = this.getZoomLevel();
|
|
4281
4285
|
const viewportPageBounds = this.getViewportPageBounds();
|
|
4282
4286
|
const {
|
|
4283
4287
|
filter,
|
|
@@ -4292,7 +4296,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
4292
4296
|
let inHollowSmallestAreaHit = null;
|
|
4293
4297
|
let inMarginClosestToEdgeDistance = Infinity;
|
|
4294
4298
|
let inMarginClosestToEdgeHit = null;
|
|
4295
|
-
const searchMargin = Math.max(innerMargin, outerMargin, this.
|
|
4299
|
+
const searchMargin = Math.max(innerMargin, outerMargin, this.getHitTestMargin());
|
|
4296
4300
|
const candidateIds = this._spatialIndex.getShapeIdsAtPoint(point, searchMargin);
|
|
4297
4301
|
const shapesToCheck = (opts.renderingOnly ? this.getCurrentPageRenderingShapesSorted() : this.getCurrentPageShapesSorted()).filter((shape) => {
|
|
4298
4302
|
if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) return false;
|
|
@@ -4383,7 +4387,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
4383
4387
|
}
|
|
4384
4388
|
}
|
|
4385
4389
|
} else {
|
|
4386
|
-
if (distance < this.
|
|
4390
|
+
if (distance < this.getHitTestMargin()) {
|
|
4387
4391
|
return shape;
|
|
4388
4392
|
}
|
|
4389
4393
|
}
|
|
@@ -8636,6 +8640,9 @@ __decorateClass([
|
|
|
8636
8640
|
__decorateClass([
|
|
8637
8641
|
import_state.computed
|
|
8638
8642
|
], Editor.prototype, "getCurrentPageBounds", 1);
|
|
8643
|
+
__decorateClass([
|
|
8644
|
+
import_state.computed
|
|
8645
|
+
], Editor.prototype, "getHitTestMargin", 1);
|
|
8639
8646
|
__decorateClass([
|
|
8640
8647
|
import_state.computed
|
|
8641
8648
|
], Editor.prototype, "getCurrentPageShapes", 1);
|