@pixerate/editor-react 0.99.0 → 0.100.0
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.
|
@@ -200,6 +200,7 @@ import {
|
|
|
200
200
|
canvasToImagePoint,
|
|
201
201
|
imageToCanvasPoint,
|
|
202
202
|
createImagePlaybackLocator,
|
|
203
|
+
agentDragDraft,
|
|
203
204
|
hitTestCrop,
|
|
204
205
|
getCropCursor,
|
|
205
206
|
calculateCropDrag,
|
|
@@ -216,6 +217,7 @@ import {
|
|
|
216
217
|
DEFAULT_SHAPE_TOOL_OPTIONS,
|
|
217
218
|
DEFAULT_TYPE_TOOL_OPTIONS
|
|
218
219
|
} from "@pixerate/editor/image-editor";
|
|
220
|
+
import { trackPresenceDrag } from "@pixerate/editor/tools";
|
|
219
221
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
220
222
|
var ImageEditorCanvas = ({
|
|
221
223
|
editor,
|
|
@@ -386,6 +388,29 @@ var ImageEditorCanvas = ({
|
|
|
386
388
|
},
|
|
387
389
|
[controller, mode, fit, transformTool]
|
|
388
390
|
);
|
|
391
|
+
useEffect2(() => {
|
|
392
|
+
let drafting = false;
|
|
393
|
+
return agentPresence.subscribe(
|
|
394
|
+
trackPresenceDrag({
|
|
395
|
+
onDrag: (box) => {
|
|
396
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
397
|
+
const draft = agentDragDraft(modeRef.current, box, controller.getState().imageDimensions);
|
|
398
|
+
if (!draft) return;
|
|
399
|
+
drafting = true;
|
|
400
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
401
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
402
|
+
void renderCanvas();
|
|
403
|
+
},
|
|
404
|
+
onEnd: () => {
|
|
405
|
+
if (!drafting) return;
|
|
406
|
+
drafting = false;
|
|
407
|
+
draftCropRef.current = null;
|
|
408
|
+
selectionDraftRef.current = null;
|
|
409
|
+
void renderCanvas();
|
|
410
|
+
}
|
|
411
|
+
})
|
|
412
|
+
);
|
|
413
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
389
414
|
useEffect2(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
390
415
|
const finishTyping = () => {
|
|
391
416
|
typeToolRef.current?.finish();
|
|
@@ -277,6 +277,9 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
277
277
|
return presence;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
// src/image-editor/ImageEditorCanvas.tsx
|
|
281
|
+
var import_tools2 = require("@pixerate/editor/tools");
|
|
282
|
+
|
|
280
283
|
// src/playback/PresenceLayer.tsx
|
|
281
284
|
var import_react4 = __toESM(require("react"), 1);
|
|
282
285
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -490,6 +493,29 @@ var ImageEditorCanvas = ({
|
|
|
490
493
|
},
|
|
491
494
|
[controller, mode, fit, transformTool]
|
|
492
495
|
);
|
|
496
|
+
(0, import_react5.useEffect)(() => {
|
|
497
|
+
let drafting = false;
|
|
498
|
+
return agentPresence.subscribe(
|
|
499
|
+
(0, import_tools2.trackPresenceDrag)({
|
|
500
|
+
onDrag: (box) => {
|
|
501
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
502
|
+
const draft = (0, import_image_editor2.agentDragDraft)(modeRef.current, box, controller.getState().imageDimensions);
|
|
503
|
+
if (!draft) return;
|
|
504
|
+
drafting = true;
|
|
505
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
506
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
507
|
+
void renderCanvas();
|
|
508
|
+
},
|
|
509
|
+
onEnd: () => {
|
|
510
|
+
if (!drafting) return;
|
|
511
|
+
drafting = false;
|
|
512
|
+
draftCropRef.current = null;
|
|
513
|
+
selectionDraftRef.current = null;
|
|
514
|
+
void renderCanvas();
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
);
|
|
518
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
493
519
|
(0, import_react5.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
494
520
|
const finishTyping = () => {
|
|
495
521
|
typeToolRef.current?.finish();
|
package/dist/index.cjs
CHANGED
|
@@ -4015,6 +4015,7 @@ var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
|
4015
4015
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
4016
4016
|
var import_react40 = require("react");
|
|
4017
4017
|
var import_image_editor2 = require("@pixerate/editor/image-editor");
|
|
4018
|
+
var import_tools4 = require("@pixerate/editor/tools");
|
|
4018
4019
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4019
4020
|
var ImageEditorCanvas = ({
|
|
4020
4021
|
editor,
|
|
@@ -4185,6 +4186,29 @@ var ImageEditorCanvas = ({
|
|
|
4185
4186
|
},
|
|
4186
4187
|
[controller, mode, fit, transformTool]
|
|
4187
4188
|
);
|
|
4189
|
+
(0, import_react40.useEffect)(() => {
|
|
4190
|
+
let drafting = false;
|
|
4191
|
+
return agentPresence.subscribe(
|
|
4192
|
+
(0, import_tools4.trackPresenceDrag)({
|
|
4193
|
+
onDrag: (box) => {
|
|
4194
|
+
if (cropDragInfoRef.current || selectionGestureRef.current?.active) return;
|
|
4195
|
+
const draft = (0, import_image_editor2.agentDragDraft)(modeRef.current, box, controller.getState().imageDimensions);
|
|
4196
|
+
if (!draft) return;
|
|
4197
|
+
drafting = true;
|
|
4198
|
+
if ("crop" in draft) draftCropRef.current = draft.crop;
|
|
4199
|
+
else selectionDraftRef.current = draft.selectionPath;
|
|
4200
|
+
void renderCanvas();
|
|
4201
|
+
},
|
|
4202
|
+
onEnd: () => {
|
|
4203
|
+
if (!drafting) return;
|
|
4204
|
+
drafting = false;
|
|
4205
|
+
draftCropRef.current = null;
|
|
4206
|
+
selectionDraftRef.current = null;
|
|
4207
|
+
void renderCanvas();
|
|
4208
|
+
}
|
|
4209
|
+
})
|
|
4210
|
+
);
|
|
4211
|
+
}, [agentPresence, controller, renderCanvas]);
|
|
4188
4212
|
(0, import_react40.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
|
|
4189
4213
|
const finishTyping = () => {
|
|
4190
4214
|
typeToolRef.current?.finish();
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
},
|
|
246
246
|
"peerDependencies": {
|
|
247
247
|
"@dagrejs/dagre": "^1.1.8",
|
|
248
|
-
"@pixerate/editor": ">=0.
|
|
248
|
+
"@pixerate/editor": ">=0.150.0 <1.0.0-0",
|
|
249
249
|
"@tiptap/core": "^2.27.3",
|
|
250
250
|
"@tiptap/pm": "^2.27.3",
|
|
251
251
|
"@tiptap/react": "^2.27.3",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
"tsup": "^9.0.0",
|
|
273
273
|
"typescript": "^5.7.3",
|
|
274
274
|
"vitest": "^5.0.5",
|
|
275
|
-
"@pixerate/editor": "0.
|
|
275
|
+
"@pixerate/editor": "0.150.0"
|
|
276
276
|
},
|
|
277
277
|
"scripts": {
|
|
278
278
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|