@sequent-org/moodboard 1.2.119 → 1.3.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.
- package/package.json +11 -1
- package/src/assets/icons/rotate-icon.svg +1 -1
- package/src/core/HistoryManager.js +16 -16
- package/src/core/KeyboardManager.js +48 -539
- package/src/core/PixiEngine.js +9 -9
- package/src/core/SaveManager.js +56 -31
- package/src/core/bootstrap/CoreInitializer.js +65 -0
- package/src/core/commands/DeleteObjectCommand.js +8 -0
- package/src/core/commands/GroupDeleteCommand.js +75 -0
- package/src/core/commands/GroupRotateCommand.js +6 -0
- package/src/core/commands/UpdateContentCommand.js +52 -0
- package/src/core/commands/UpdateFramePropertiesCommand.js +98 -0
- package/src/core/commands/UpdateFrameTypeCommand.js +85 -0
- package/src/core/commands/UpdateNoteStyleCommand.js +88 -0
- package/src/core/commands/UpdateTextStyleCommand.js +90 -0
- package/src/core/commands/index.js +6 -0
- package/src/core/events/Events.js +6 -0
- package/src/core/flows/ClipboardFlow.js +553 -0
- package/src/core/flows/LayerAndViewportFlow.js +283 -0
- package/src/core/flows/ObjectLifecycleFlow.js +336 -0
- package/src/core/flows/SaveFlow.js +34 -0
- package/src/core/flows/TransformFlow.js +277 -0
- package/src/core/flows/TransformFlowResizeHelpers.js +83 -0
- package/src/core/index.js +41 -1773
- package/src/core/keyboard/KeyboardClipboardImagePaste.js +190 -0
- package/src/core/keyboard/KeyboardContextGuards.js +35 -0
- package/src/core/keyboard/KeyboardEventRouter.js +92 -0
- package/src/core/keyboard/KeyboardSelectionActions.js +103 -0
- package/src/core/keyboard/KeyboardShortcutMap.js +31 -0
- package/src/core/keyboard/KeyboardToolSwitching.js +26 -0
- package/src/core/rendering/ObjectRenderer.js +3 -7
- package/src/grid/BaseGrid.js +26 -0
- package/src/grid/CrossGrid.js +7 -6
- package/src/grid/DotGrid.js +89 -33
- package/src/grid/DotGridZoomPhases.js +42 -0
- package/src/grid/LineGrid.js +22 -21
- package/src/moodboard/MoodBoard.js +31 -532
- package/src/moodboard/bootstrap/MoodBoardInitializer.js +47 -0
- package/src/moodboard/bootstrap/MoodBoardManagersFactory.js +38 -0
- package/src/moodboard/bootstrap/MoodBoardUiFactory.js +109 -0
- package/src/moodboard/integration/MoodBoardEventBindings.js +65 -0
- package/src/moodboard/integration/MoodBoardLoadApi.js +82 -0
- package/src/moodboard/integration/MoodBoardScreenshotApi.js +33 -0
- package/src/moodboard/integration/MoodBoardScreenshotCanvas.js +98 -0
- package/src/moodboard/lifecycle/MoodBoardDestroyer.js +97 -0
- package/src/objects/FileObject.js +17 -6
- package/src/objects/FrameObject.js +50 -10
- package/src/objects/NoteObject.js +5 -4
- package/src/services/BoardService.js +42 -2
- package/src/services/FrameService.js +83 -42
- package/src/services/ResizePolicyService.js +152 -0
- package/src/services/SettingsApplier.js +7 -2
- package/src/services/ZoomPanController.js +35 -9
- package/src/tools/ToolManager.js +30 -537
- package/src/tools/board-tools/PanTool.js +5 -11
- package/src/tools/manager/ToolActivationController.js +49 -0
- package/src/tools/manager/ToolEventRouter.js +396 -0
- package/src/tools/manager/ToolManagerGuards.js +33 -0
- package/src/tools/manager/ToolManagerLifecycle.js +110 -0
- package/src/tools/manager/ToolRegistry.js +33 -0
- package/src/tools/object-tools/DrawingTool.js +48 -14
- package/src/tools/object-tools/PlacementTool.js +50 -1049
- package/src/tools/object-tools/PlacementToolV2.js +88 -0
- package/src/tools/object-tools/SelectTool.js +174 -2681
- package/src/tools/object-tools/placement/GhostController.js +504 -0
- package/src/tools/object-tools/placement/PlacementCoordinateResolver.js +20 -0
- package/src/tools/object-tools/placement/PlacementEventsBridge.js +91 -0
- package/src/tools/object-tools/placement/PlacementInputRouter.js +267 -0
- package/src/tools/object-tools/placement/PlacementPayloadFactory.js +111 -0
- package/src/tools/object-tools/placement/PlacementSessionStore.js +18 -0
- package/src/tools/object-tools/selection/BoxSelectController.js +0 -5
- package/src/tools/object-tools/selection/CloneFlowController.js +71 -0
- package/src/tools/object-tools/selection/CoordinateMapper.js +10 -0
- package/src/tools/object-tools/selection/CursorController.js +78 -0
- package/src/tools/object-tools/selection/FileNameInlineEditorController.js +184 -0
- package/src/tools/object-tools/selection/HitTestService.js +102 -0
- package/src/tools/object-tools/selection/InlineEditorController.js +24 -0
- package/src/tools/object-tools/selection/InlineEditorDomFactory.js +50 -0
- package/src/tools/object-tools/selection/InlineEditorListenersRegistry.js +14 -0
- package/src/tools/object-tools/selection/InlineEditorPositioningService.js +25 -0
- package/src/tools/object-tools/selection/NoteInlineEditorController.js +113 -0
- package/src/tools/object-tools/selection/SelectInputRouter.js +267 -0
- package/src/tools/object-tools/selection/SelectToolLifecycleController.js +128 -0
- package/src/tools/object-tools/selection/SelectToolSetup.js +134 -0
- package/src/tools/object-tools/selection/SelectionOverlayService.js +81 -0
- package/src/tools/object-tools/selection/SelectionStateController.js +91 -0
- package/src/tools/object-tools/selection/TextEditorDomFactory.js +65 -0
- package/src/tools/object-tools/selection/TextEditorInteractionController.js +266 -0
- package/src/tools/object-tools/selection/TextEditorLifecycleRegistry.js +90 -0
- package/src/tools/object-tools/selection/TextEditorPositioningService.js +158 -0
- package/src/tools/object-tools/selection/TextEditorSyncService.js +110 -0
- package/src/tools/object-tools/selection/TextInlineEditorController.js +457 -0
- package/src/tools/object-tools/selection/TransformInteractionController.js +466 -0
- package/src/ui/FilePropertiesPanel.js +61 -32
- package/src/ui/FramePropertiesPanel.js +176 -101
- package/src/ui/HtmlHandlesLayer.js +121 -999
- package/src/ui/MapPanel.js +12 -7
- package/src/ui/NotePropertiesPanel.js +17 -2
- package/src/ui/TextPropertiesPanel.js +124 -738
- package/src/ui/Toolbar.js +71 -1180
- package/src/ui/Topbar.js +23 -25
- package/src/ui/ZoomPanel.js +16 -5
- package/src/ui/handles/GroupSelectionHandlesController.js +29 -0
- package/src/ui/handles/HandlesDomRenderer.js +278 -0
- package/src/ui/handles/HandlesEventBridge.js +102 -0
- package/src/ui/handles/HandlesInteractionController.js +772 -0
- package/src/ui/handles/HandlesPositioningService.js +206 -0
- package/src/ui/handles/SingleSelectionHandlesController.js +22 -0
- package/src/ui/styles/toolbar.css +2 -0
- package/src/ui/styles/workspace.css +13 -6
- package/src/ui/text-properties/TextPropertiesPanelBindings.js +92 -0
- package/src/ui/text-properties/TextPropertiesPanelEventBridge.js +77 -0
- package/src/ui/text-properties/TextPropertiesPanelMapper.js +173 -0
- package/src/ui/text-properties/TextPropertiesPanelRenderer.js +434 -0
- package/src/ui/text-properties/TextPropertiesPanelState.js +39 -0
- package/src/ui/toolbar/ToolbarActionRouter.js +193 -0
- package/src/ui/toolbar/ToolbarDialogsController.js +186 -0
- package/src/ui/toolbar/ToolbarPopupsController.js +662 -0
- package/src/ui/toolbar/ToolbarRenderer.js +97 -0
- package/src/ui/toolbar/ToolbarStateController.js +79 -0
- package/src/ui/toolbar/ToolbarTooltipController.js +52 -0
- package/src/utils/emojiLoaderNoBundler.js +1 -1
|
@@ -2,6 +2,9 @@ import { BaseTool } from '../BaseTool.js';
|
|
|
2
2
|
import { Events } from '../../core/events/Events.js';
|
|
3
3
|
import * as PIXI from 'pixi.js';
|
|
4
4
|
|
|
5
|
+
/** Максимум точек в одном штрихе (decimation при превышении). */
|
|
6
|
+
const MAX_POINTS = 5000;
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* Инструмент рисования (карандаш)
|
|
7
10
|
*/
|
|
@@ -30,20 +33,16 @@ export class DrawingTool extends BaseTool {
|
|
|
30
33
|
this._eraserDeleted = new Set();
|
|
31
34
|
this._eraserIdleTimer = null;
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
this._onBrushSet = (data) => {
|
|
37
|
+
if (!data || this.destroyed) return;
|
|
38
|
+
const patch = {};
|
|
39
|
+
if (typeof data.width === 'number') patch.width = data.width;
|
|
40
|
+
if (typeof data.color === 'number') patch.color = data.color;
|
|
41
|
+
if (typeof data.mode === 'string') patch.mode = data.mode;
|
|
42
|
+
this.brush = { ...this.brush, ...patch };
|
|
43
|
+
};
|
|
34
44
|
if (this.eventBus) {
|
|
35
|
-
this.eventBus.on(Events.Draw.BrushSet,
|
|
36
|
-
if (!data) return;
|
|
37
|
-
const patch = {};
|
|
38
|
-
if (typeof data.width === 'number') patch.width = data.width;
|
|
39
|
-
if (typeof data.color === 'number') patch.color = data.color;
|
|
40
|
-
if (typeof data.mode === 'string') patch.mode = data.mode;
|
|
41
|
-
this.brush = { ...this.brush, ...patch };
|
|
42
|
-
});
|
|
43
|
-
// Удаление объектов ластиком: кликаем по объекту — если попали, удаляем
|
|
44
|
-
this.eventBus.on(Events.Tool.HitTest, (data) => {
|
|
45
|
-
// Прокси для совместимости, не используем здесь
|
|
46
|
-
});
|
|
45
|
+
this.eventBus.on(Events.Draw.BrushSet, this._onBrushSet);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -66,6 +65,23 @@ export class DrawingTool extends BaseTool {
|
|
|
66
65
|
this.world = null;
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
destroy() {
|
|
69
|
+
if (this.destroyed) return;
|
|
70
|
+
if (this.eventBus) {
|
|
71
|
+
this.eventBus.off(Events.Draw.BrushSet, this._onBrushSet);
|
|
72
|
+
}
|
|
73
|
+
if (this._eraserIdleTimer) {
|
|
74
|
+
clearTimeout(this._eraserIdleTimer);
|
|
75
|
+
this._eraserIdleTimer = null;
|
|
76
|
+
}
|
|
77
|
+
if (this.tempGraphics) {
|
|
78
|
+
if (this.tempGraphics.parent) this.tempGraphics.parent.removeChild(this.tempGraphics);
|
|
79
|
+
this.tempGraphics.destroy();
|
|
80
|
+
this.tempGraphics = null;
|
|
81
|
+
}
|
|
82
|
+
super.destroy();
|
|
83
|
+
}
|
|
84
|
+
|
|
69
85
|
setCursor() {
|
|
70
86
|
if (this.app && this.app.view) {
|
|
71
87
|
this.app.view.style.cursor = this.cursor;
|
|
@@ -176,8 +192,12 @@ export class DrawingTool extends BaseTool {
|
|
|
176
192
|
const width = Math.max(1, Math.round(maxX - minX));
|
|
177
193
|
const height = Math.max(1, Math.round(maxY - minY));
|
|
178
194
|
|
|
195
|
+
let pointsToUse = this.points;
|
|
196
|
+
if (pointsToUse.length > MAX_POINTS) {
|
|
197
|
+
pointsToUse = this._decimatePoints(pointsToUse, MAX_POINTS);
|
|
198
|
+
}
|
|
179
199
|
// Нормализуем точки относительно левого-верхнего угла
|
|
180
|
-
const normPoints =
|
|
200
|
+
const normPoints = pointsToUse.map(pt => ({ x: pt.x - minX, y: pt.y - minY }));
|
|
181
201
|
|
|
182
202
|
// Создаем объект типа drawing через существующий пайплайн
|
|
183
203
|
const position = { x: Math.round(minX), y: Math.round(minY) };
|
|
@@ -398,6 +418,20 @@ export class DrawingTool extends BaseTool {
|
|
|
398
418
|
}
|
|
399
419
|
}
|
|
400
420
|
|
|
421
|
+
_decimatePoints(points, maxLen) {
|
|
422
|
+
if (!points || points.length <= maxLen) return points;
|
|
423
|
+
if (maxLen <= 2) return [points[0], points[points.length - 1]].filter(Boolean);
|
|
424
|
+
const result = [];
|
|
425
|
+
result.push(points[0]);
|
|
426
|
+
for (let i = 1; i < maxLen - 1; i++) {
|
|
427
|
+
const t = i / (maxLen - 1);
|
|
428
|
+
const idx = Math.floor(t * (points.length - 1));
|
|
429
|
+
result.push(points[idx]);
|
|
430
|
+
}
|
|
431
|
+
result.push(points[points.length - 1]);
|
|
432
|
+
return result;
|
|
433
|
+
}
|
|
434
|
+
|
|
401
435
|
_distancePointToSegment(px, py, ax, ay, bx, by) {
|
|
402
436
|
const abx = bx - ax;
|
|
403
437
|
const aby = by - ay;
|