@sequent-org/moodboard 1.4.68 → 1.4.70

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.4.68",
3
+ "version": "1.4.70",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -13,6 +13,25 @@ export class PixiEngine {
13
13
  }
14
14
 
15
15
  async init() {
16
+ // Некоторые GPU (мобильные планшеты) поддерживают меньше MSAA-сэмплов, чем Pixi
17
+ // запрашивает для render-target/фильтров. Без ограничения это даёт
18
+ // "renderbufferStorageMultisample: samples too large" → incomplete framebuffer →
19
+ // объекты не отрисовываются. Обрезаем число сэмплов до максимума устройства.
20
+ if (typeof WebGL2RenderingContext !== 'undefined') {
21
+ const proto = WebGL2RenderingContext.prototype;
22
+ if (!proto.__mbMsaaClamped && typeof proto.renderbufferStorageMultisample === 'function') {
23
+ const origRBSM = proto.renderbufferStorageMultisample;
24
+ proto.renderbufferStorageMultisample = function (target, samples, internalformat, width, height) {
25
+ try {
26
+ const max = this.getParameter(this.MAX_SAMPLES) || 0;
27
+ if (max && samples > max) { samples = max; }
28
+ } catch (_) {}
29
+ return origRBSM.call(this, target, samples, internalformat, width, height);
30
+ };
31
+ proto.__mbMsaaClamped = true;
32
+ }
33
+ }
34
+
16
35
  this.app = new PIXI.Application({
17
36
  width: this.options.width,
18
37
  height: this.options.height,
@@ -61,6 +61,10 @@ export async function wireCommentsSubsystem(board) {
61
61
 
62
62
  try {
63
63
  await board.commentService.loadInitial();
64
+ // Экземпляр мог быть уничтожен (destroy() при переключении вкладки/повторном
65
+ // открытии), пока висел медленный запрос комментариев. Тогда coreMoodboard и
66
+ // слои уже обнулены — не трогаем их, иначе обращение к null рушит init.
67
+ if (board.destroyed) return;
64
68
  board.commentPinLayer.rebuild();
65
69
  const initialThreadId = board.options.initialThreadId;
66
70
  if (initialThreadId != null) {
@@ -100,9 +104,15 @@ export async function initializeMoodBoard(board) {
100
104
  board.topbarContainer = topbar;
101
105
 
102
106
  await initCoreMoodBoard(board);
107
+ // Каждый await — окно, в котором destroy() (переключение вкладки/повторное
108
+ // открытие) обнуляет coreMoodboard. После await проверяем флаг и прекращаем
109
+ // инициализацию уничтоженного экземпляра, иначе wireMoodBoardServices/
110
+ // loadExistingBoard падают на чтении свойств null и оставляют пустой контейнер.
111
+ if (board.destroyed) return;
103
112
  createMoodBoardManagers(board);
104
113
  createMoodBoardUi(board);
105
114
  await wireCommentsSubsystem(board);
115
+ if (board.destroyed) return;
106
116
  wireMoodBoardServices(board);
107
117
  bindSaveCallbacks(board);
108
118
 
@@ -218,6 +218,7 @@ export function bindTextEditorInteractions(controller, {
218
218
  finalize,
219
219
  listType,
220
220
  }) {
221
+ const editorCreatedAt = Date.now();
221
222
  const blurHandler = () => {
222
223
  const editorObjectId = controller?.textEditor?.objectId || null;
223
224
  setTimeout(() => {
@@ -227,6 +228,14 @@ export function bindTextEditorInteractions(controller, {
227
228
  if ((controller?.textEditor?.objectId || null) !== editorObjectId) return;
228
229
  if (controller?.textEditor?._closingByOutside) return;
229
230
 
231
+ // На touch создающий тап порождает синтетический mousedown по холсту,
232
+ // который тут же снимает фокус с только что созданного пустого поля.
233
+ // В течение короткого окна после создания не финализируем, а возвращаем фокус.
234
+ if (isNewCreation && (Date.now() - editorCreatedAt) < 400) {
235
+ try { textarea.focus(); } catch (_) {}
236
+ return;
237
+ }
238
+
230
239
  const value = (textarea.value || '').trim();
231
240
  if (isNewCreation && value.length === 0) {
232
241
  // Записка и фигура остаются на доске пустыми: finalize(true) при пустом