@sequent-org/moodboard 1.0.9 → 1.0.10
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
CHANGED
package/src/core/PixiEngine.js
CHANGED
|
@@ -17,8 +17,7 @@ export class PixiEngine {
|
|
|
17
17
|
backgroundColor: this.options.backgroundColor,
|
|
18
18
|
antialias: true,
|
|
19
19
|
resolution: (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1,
|
|
20
|
-
autoDensity: true
|
|
21
|
-
resizeTo: this.container // Автоматически изменять размер при изменении контейнера
|
|
20
|
+
autoDensity: true
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
this.container.appendChild(this.app.view);
|
|
@@ -434,17 +433,6 @@ export class PixiEngine {
|
|
|
434
433
|
return null;
|
|
435
434
|
}
|
|
436
435
|
|
|
437
|
-
/**
|
|
438
|
-
* Изменяет размер PIXI приложения
|
|
439
|
-
* @param {number} width - новая ширина
|
|
440
|
-
* @param {number} height - новая высота
|
|
441
|
-
*/
|
|
442
|
-
resize(width, height) {
|
|
443
|
-
if (this.app && this.app.renderer) {
|
|
444
|
-
this.app.renderer.resize(width, height);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
436
|
destroy() {
|
|
449
437
|
this.app.destroy(true);
|
|
450
438
|
}
|
package/src/core/index.js
CHANGED
|
@@ -36,37 +36,6 @@ export class CoreMoodBoard {
|
|
|
36
36
|
backgroundColor: 0xF5F5F5,
|
|
37
37
|
...options
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
// Устанавливаем размеры контейнера, если они не заданы
|
|
41
|
-
if (!this.options.width || this.options.width === 800) {
|
|
42
|
-
this.options.width = this.container.clientWidth || 800;
|
|
43
|
-
}
|
|
44
|
-
if (!this.options.height || this.options.height === 600) {
|
|
45
|
-
this.options.height = this.container.clientHeight || 600;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Создаем ResizeObserver для отслеживания изменений размера контейнера
|
|
49
|
-
this.resizeObserver = null;
|
|
50
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
51
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
52
|
-
for (const entry of entries) {
|
|
53
|
-
const { width, height } = entry.contentRect;
|
|
54
|
-
if (this.pixi && this.pixi.app) {
|
|
55
|
-
// Обновляем размеры PIXI приложения
|
|
56
|
-
this.pixi.resize(width, height);
|
|
57
|
-
// Обновляем размеры в опциях
|
|
58
|
-
this.options.width = width;
|
|
59
|
-
this.options.height = height;
|
|
60
|
-
// Обновляем размеры рабочего пространства
|
|
61
|
-
if (this.workspaceManager) {
|
|
62
|
-
this.workspaceManager.updateSize();
|
|
63
|
-
}
|
|
64
|
-
// Уведомляем о изменении размера
|
|
65
|
-
this.eventBus.emit('resize', { width, height });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
39
|
|
|
71
40
|
this.eventBus = new EventBus();
|
|
72
41
|
this.state = new StateManager(this.eventBus);
|
|
@@ -103,11 +72,6 @@ export class CoreMoodBoard {
|
|
|
103
72
|
try {
|
|
104
73
|
await this.pixi.init();
|
|
105
74
|
this.keyboard.startListening(); // Запускаем прослушивание клавиатуры
|
|
106
|
-
|
|
107
|
-
// Запускаем отслеживание изменения размера контейнера
|
|
108
|
-
if (this.resizeObserver) {
|
|
109
|
-
this.resizeObserver.observe(this.container);
|
|
110
|
-
}
|
|
111
75
|
|
|
112
76
|
// Инициализируем систему инструментов
|
|
113
77
|
await this.initTools();
|
|
@@ -1659,12 +1623,6 @@ export class CoreMoodBoard {
|
|
|
1659
1623
|
}
|
|
1660
1624
|
|
|
1661
1625
|
destroy() {
|
|
1662
|
-
// Останавливаем отслеживание изменения размера
|
|
1663
|
-
if (this.resizeObserver) {
|
|
1664
|
-
this.resizeObserver.disconnect();
|
|
1665
|
-
this.resizeObserver = null;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
1626
|
this.saveManager.destroy();
|
|
1669
1627
|
this.keyboard.destroy();
|
|
1670
1628
|
this.history.destroy();
|
|
@@ -322,26 +322,6 @@ export class MoodBoard {
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
/**
|
|
326
|
-
* Обновляет размеры холста
|
|
327
|
-
*/
|
|
328
|
-
updateSize() {
|
|
329
|
-
if (this.workspaceManager) {
|
|
330
|
-
return this.workspaceManager.updateSize();
|
|
331
|
-
}
|
|
332
|
-
return null;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Получает текущие размеры холста
|
|
337
|
-
*/
|
|
338
|
-
getSize() {
|
|
339
|
-
if (this.workspaceManager) {
|
|
340
|
-
return this.workspaceManager.getCanvasSize();
|
|
341
|
-
}
|
|
342
|
-
return { width: 800, height: 600 };
|
|
343
|
-
}
|
|
344
|
-
|
|
345
325
|
/**
|
|
346
326
|
* Очистка ресурсов
|
|
347
327
|
*/
|
|
@@ -83,29 +83,12 @@ export class WorkspaceManager {
|
|
|
83
83
|
return { width: 800, height: 600 };
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
// Получаем размеры родительского контейнера
|
|
87
|
-
const parentWidth = this.container.clientWidth;
|
|
88
|
-
const parentHeight = this.container.clientHeight;
|
|
89
|
-
|
|
90
86
|
return {
|
|
91
|
-
width:
|
|
92
|
-
height:
|
|
87
|
+
width: this.canvasContainer.clientWidth,
|
|
88
|
+
height: this.canvasContainer.clientHeight
|
|
93
89
|
};
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
/**
|
|
97
|
-
* Обновляет размеры рабочего пространства
|
|
98
|
-
*/
|
|
99
|
-
updateSize() {
|
|
100
|
-
if (this.canvasContainer && this.container) {
|
|
101
|
-
const size = this.getCanvasSize();
|
|
102
|
-
this.canvasContainer.style.width = size.width + 'px';
|
|
103
|
-
this.canvasContainer.style.height = size.height + 'px';
|
|
104
|
-
return size;
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
92
|
/**
|
|
110
93
|
* Очистка ресурсов
|
|
111
94
|
*/
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.moodboard-workspace {
|
|
18
|
-
position:
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
position: fixed;
|
|
19
|
+
inset: 0;
|
|
20
|
+
width: 100vw;
|
|
21
|
+
height: 100vh;
|
|
21
22
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
22
23
|
overflow: hidden;
|
|
23
24
|
}
|
|
@@ -174,10 +175,7 @@
|
|
|
174
175
|
/* Canvas Container */
|
|
175
176
|
.moodboard-workspace__canvas {
|
|
176
177
|
position: absolute;
|
|
177
|
-
|
|
178
|
-
left: 0;
|
|
179
|
-
right: 0;
|
|
180
|
-
bottom: 0;
|
|
178
|
+
inset: 0;
|
|
181
179
|
overflow: hidden;
|
|
182
180
|
}
|
|
183
181
|
|