@shijiu/jsview-vue 2.1.367-test.0 → 2.1.428
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/bin/jsview-vue.mjs +843 -508
- package/package.json +1 -1
- package/tools/config/vite.config.ts +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +4 -8
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +8 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +194 -167
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +7 -3
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +8 -5
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +173 -0
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +4 -0
- package/utils/JsViewVueTools/JsvTextureDefines.ts +11 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +27 -3
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +1 -1
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +0 -28
- package/utils/JsViewVueTools/index.js +1 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +118 -0
- package/utils/JsViewVueWidget/JsvFlexCell/index.js +6 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +29 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +4 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +26 -25
- package/utils/JsViewVueWidget/JsvPieChart.vue +37 -37
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +29 -9
- package/utils/JsViewVueWidget/JsvSceneTransition.vue +174 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +41 -30
- package/utils/JsViewVueWidget/JsvTextBox.vue +20 -34
- package/utils/JsViewVueWidget/index.js +2 -0
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +0 -189
|
@@ -26,8 +26,8 @@ import {
|
|
|
26
26
|
import { RenderItem } from "./RenderItem";
|
|
27
27
|
import { VisibleInfo } from "./VisibleInfo";
|
|
28
28
|
import { WidgetRectInfo } from "./WidgetRectInfo";
|
|
29
|
-
import { TaskType, MacroEndTaskManager, AnimationManager } from "./AnimationManager.ts"
|
|
30
29
|
import ActorControl from "../../JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts";
|
|
30
|
+
import { TaskType, SlideAnimWrapper, TaskManager, AnimationManager } from "./TaskManager.ts";
|
|
31
31
|
|
|
32
32
|
const TAG = "MetroWidget";
|
|
33
33
|
|
|
@@ -108,6 +108,7 @@ export const setup = (
|
|
|
108
108
|
FLING: 3,
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
const modeForExport = ref(FOCUS_MODE);
|
|
111
112
|
const mode = {
|
|
112
113
|
_mode: FOCUS_MODE,
|
|
113
114
|
_touchState: TouchState.IDLE,
|
|
@@ -116,6 +117,7 @@ export const setup = (
|
|
|
116
117
|
_duringFling: false,
|
|
117
118
|
touchStart() {
|
|
118
119
|
this._mode = TOUCH_MODE;
|
|
120
|
+
modeForExport.value = TOUCH_MODE;
|
|
119
121
|
this._touchState = TouchState.TAP;
|
|
120
122
|
},
|
|
121
123
|
touchEnd() {
|
|
@@ -131,6 +133,7 @@ export const setup = (
|
|
|
131
133
|
dragEnd() { },
|
|
132
134
|
keyDown() {
|
|
133
135
|
this._mode = FOCUS_MODE;
|
|
136
|
+
modeForExport.value = FOCUS_MODE;
|
|
134
137
|
this._touchState = TouchState.IDLE;
|
|
135
138
|
},
|
|
136
139
|
duringFling() {
|
|
@@ -179,7 +182,7 @@ export const setup = (
|
|
|
179
182
|
&& item.templateInfo[pos_key] + item.templateInfo[size_key] - 1 < visibleInfo.end;
|
|
180
183
|
}
|
|
181
184
|
|
|
182
|
-
|
|
185
|
+
let templateCacheFrameCount = -1;
|
|
183
186
|
const onMacroTaskEnd = (taskList) => {
|
|
184
187
|
let resizeList = [];
|
|
185
188
|
let resizeTaskMap = {};
|
|
@@ -187,6 +190,7 @@ export const setup = (
|
|
|
187
190
|
//统一处理itemResize和slide动画
|
|
188
191
|
let minIndex = Infinity;
|
|
189
192
|
let slideInfo = null;
|
|
193
|
+
let mergeTmp = false;
|
|
190
194
|
let anchorInfo = null;
|
|
191
195
|
let duration = 200;
|
|
192
196
|
let easing = null;
|
|
@@ -196,8 +200,21 @@ export const setup = (
|
|
|
196
200
|
let doAnim = false;
|
|
197
201
|
|
|
198
202
|
let existOnFocusChange = false;
|
|
203
|
+
let targetVisibleStart = visibleInfo.start;
|
|
204
|
+
//先遍历寻找slide task, 确认目标位置. 有多个slide task时取最后一个
|
|
205
|
+
taskList.forEach(i => {
|
|
206
|
+
if (i.type == TaskType.SLIDE) {
|
|
207
|
+
slideTask = i;
|
|
208
|
+
mergeTmp = mergeTmp || i.params?.updateParam?.mergeTmp;
|
|
209
|
+
if (!isNaN(i.params?.target)) {
|
|
210
|
+
targetVisibleStart = -i.params.target;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
199
215
|
for (let task of taskList) {
|
|
200
216
|
if (task.type == TaskType.RESIZE_ITEM) {
|
|
217
|
+
mergeTmp = mergeTmp || task.params?.updateParam?.mergeTmp;
|
|
201
218
|
resizeTaskMap[task.params.index] = task;
|
|
202
219
|
resizeList.push(task);
|
|
203
220
|
const { index, animInfo } = task.params;
|
|
@@ -211,13 +228,10 @@ export const setup = (
|
|
|
211
228
|
//记录锚点信息
|
|
212
229
|
const item = getItemByIndex(index);
|
|
213
230
|
anchorInfo = {
|
|
214
|
-
anchorPosition: item.templateInfo[pos_key] + item.templateInfo[size_key] * animInfo.anchor - 1 -
|
|
231
|
+
anchorPosition: item.templateInfo[pos_key] + item.templateInfo[size_key] * animInfo.anchor - 1 - targetVisibleStart,
|
|
215
232
|
anchor: animInfo.anchor,
|
|
216
233
|
}
|
|
217
234
|
}
|
|
218
|
-
} else if (task.type == TaskType.SLIDE) {
|
|
219
|
-
//滚动动画取最后一个
|
|
220
|
-
slideTask = task;
|
|
221
235
|
} else if (task.type == TaskType.ON_FOCUS_CHANGE) {
|
|
222
236
|
existOnFocusChange = true;
|
|
223
237
|
}
|
|
@@ -234,7 +248,10 @@ export const setup = (
|
|
|
234
248
|
if (resizeList.length > 0) {
|
|
235
249
|
existItemResize = true;
|
|
236
250
|
//TODO 应该是尺寸变化后的可视item需要记录位置, 但暂时先记录20个
|
|
237
|
-
|
|
251
|
+
if (templateCacheFrameCount != Forge.sFrameCount.count) {
|
|
252
|
+
metroTemplate.cacheLayout(minIndex, minIndex + 20);
|
|
253
|
+
templateCacheFrameCount = Forge.sFrameCount.count;
|
|
254
|
+
}
|
|
238
255
|
//resize
|
|
239
256
|
resizeList.forEach(task => {
|
|
240
257
|
metroTemplate.updateItemSize(task.params.index, {
|
|
@@ -242,24 +259,19 @@ export const setup = (
|
|
|
242
259
|
height: task.params.height,
|
|
243
260
|
})
|
|
244
261
|
});
|
|
245
|
-
let preVisibleStart = visibleInfo.start;
|
|
246
262
|
//保持anchor
|
|
247
263
|
if (anchorInfo) {
|
|
248
264
|
const focusItem = getItemById(focusId);
|
|
249
265
|
const start = focusItem.templateInfo[pos_key] + focusItem.templateInfo[size_key] * anchorInfo.anchor - 1 - anchorInfo.anchorPosition;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// resize的item不能完整显示时不需要调整
|
|
253
|
-
// if (!isItemVisible(focusItem)) {
|
|
254
|
-
// visibleInfo.start = _calculateVisibleStart(getItemById(focusId).templateInfo, preSlideDirection);
|
|
255
|
-
// }
|
|
266
|
+
targetVisibleStart = normalizeVisibleStart(start, focusItem.templateInfo);
|
|
256
267
|
} else {
|
|
257
|
-
|
|
268
|
+
targetVisibleStart = _calculateVisibleStart(getItemById(focusId).templateInfo, preSlideDirection);
|
|
258
269
|
}
|
|
259
|
-
|
|
270
|
+
|
|
271
|
+
if (visibleInfo.start != targetVisibleStart) {
|
|
260
272
|
//只有resize引起的slide动画时, 动画时长使用resize设置, 否者使用slideSetting设置
|
|
261
273
|
slideInfo = {
|
|
262
|
-
target: -
|
|
274
|
+
target: -targetVisibleStart,
|
|
263
275
|
};
|
|
264
276
|
if (doAnim) {
|
|
265
277
|
slideInfo.animObj = {
|
|
@@ -267,8 +279,6 @@ export const setup = (
|
|
|
267
279
|
onStart: null,
|
|
268
280
|
speed: null,
|
|
269
281
|
duration,
|
|
270
|
-
onEnd: (animDone) => {
|
|
271
|
-
},
|
|
272
282
|
}
|
|
273
283
|
} else {
|
|
274
284
|
//resize无动画时正常slide
|
|
@@ -287,15 +297,42 @@ export const setup = (
|
|
|
287
297
|
}
|
|
288
298
|
}
|
|
289
299
|
}
|
|
290
|
-
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (targetVisibleStart != visibleInfo.start) {
|
|
303
|
+
taskManager.run(() => {
|
|
304
|
+
const preVisibleStart = visibleInfo.start;
|
|
305
|
+
visibleInfo.start = targetVisibleStart;
|
|
306
|
+
return () => {
|
|
307
|
+
visibleInfo.start = preVisibleStart;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
//updatePage
|
|
312
|
+
let updateHandler
|
|
313
|
+
taskManager.run(() => {
|
|
314
|
+
updateHandler = pageUpdater.update(
|
|
291
315
|
metroTemplate,
|
|
292
|
-
visibleInfo.startWithPadding,
|
|
293
|
-
|
|
316
|
+
visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
|
|
317
|
+
Math.min(
|
|
318
|
+
visibleInfo.startMax +
|
|
319
|
+
visibleInfo.range +
|
|
320
|
+
visibleInfo.padding.end -
|
|
321
|
+
1,
|
|
322
|
+
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
323
|
+
),
|
|
294
324
|
focusId,
|
|
295
|
-
|
|
325
|
+
mergeTmp,
|
|
296
326
|
permanentItemList
|
|
297
327
|
);
|
|
298
|
-
|
|
328
|
+
return () => {
|
|
329
|
+
updateHandler.recover();
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
// resize item 动画
|
|
334
|
+
if (resizeList.length > 0) {
|
|
335
|
+
updateHandler.applyTmp();
|
|
299
336
|
if (doAnim) {
|
|
300
337
|
const visibleIndexList = Array.from(pageUpdater.getTmpRange());
|
|
301
338
|
//创建item slide anim
|
|
@@ -304,22 +341,31 @@ export const setup = (
|
|
|
304
341
|
const { left, top } = renderItem.templateInfo;
|
|
305
342
|
if (index >= minIndex) {
|
|
306
343
|
const layoutCache = renderItem.templateInfo.layoutCache;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
resizeTaskMap[index] ?
|
|
312
|
-
resizeTaskMap[index].params.animInfo
|
|
313
|
-
: { duration: duration });
|
|
314
|
-
} else {
|
|
315
|
-
renderItem.addDivMountedListener((div) => {
|
|
316
|
-
animationManager.startSlideAnim(div,
|
|
344
|
+
const doItemSlide = (div) => {
|
|
345
|
+
taskManager.run(() => {
|
|
346
|
+
const cancel = animationManager.startSlideAnim(
|
|
347
|
+
div,
|
|
317
348
|
[layoutCache.left - left, layoutCache.top - top],
|
|
318
349
|
[0, 0],
|
|
319
350
|
resizeTaskMap[index] ?
|
|
320
351
|
resizeTaskMap[index].params.animInfo
|
|
321
|
-
: { duration: duration }
|
|
322
|
-
|
|
352
|
+
: { duration: duration }
|
|
353
|
+
)
|
|
354
|
+
return () => {
|
|
355
|
+
cancel()
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (renderItem.mounted.value) {
|
|
361
|
+
doItemSlide(renderItem.rootDiv);
|
|
362
|
+
} else {
|
|
363
|
+
taskManager.run(() => {
|
|
364
|
+
const unregister = renderItem.addDivMountedListener((div) => {
|
|
365
|
+
doItemSlide(div);
|
|
366
|
+
});
|
|
367
|
+
return unregister;
|
|
368
|
+
});
|
|
323
369
|
}
|
|
324
370
|
}
|
|
325
371
|
}
|
|
@@ -329,75 +375,81 @@ export const setup = (
|
|
|
329
375
|
//处理滚动动画
|
|
330
376
|
let viewSlid = false;
|
|
331
377
|
if (slideInfo) {
|
|
332
|
-
|
|
333
|
-
viewSlid = executeSlide(target, slideInfo);
|
|
378
|
+
viewSlid = executeSlide(slideInfo, updateHandler);
|
|
334
379
|
}
|
|
335
380
|
|
|
336
381
|
//回调
|
|
337
|
-
if (existItemResize) {
|
|
338
|
-
|
|
382
|
+
if (existItemResize && props.onAllItemResizeDone) {
|
|
383
|
+
taskManager.run(() => {
|
|
384
|
+
const handler = setTimeout(() => {
|
|
385
|
+
props.onAllItemResizeDone();
|
|
386
|
+
}, 0);
|
|
387
|
+
return () => {
|
|
388
|
+
clearTimeout(handler);
|
|
389
|
+
}
|
|
390
|
+
})
|
|
339
391
|
}
|
|
340
|
-
if (viewSlid || existOnFocusChange) {
|
|
341
|
-
|
|
392
|
+
if ((viewSlid || existOnFocusChange) && props.onFocusRectChange) {
|
|
393
|
+
taskManager.run(() => {
|
|
394
|
+
const handler = setTimeout(() => {
|
|
395
|
+
props.onFocusRectChange();
|
|
396
|
+
}, 0);
|
|
397
|
+
return () => {
|
|
398
|
+
clearTimeout(handler);
|
|
399
|
+
}
|
|
400
|
+
})
|
|
342
401
|
}
|
|
343
402
|
}
|
|
403
|
+
const taskManager = new TaskManager(onMacroTaskEnd);
|
|
404
|
+
const animationManager = new AnimationManager();
|
|
344
405
|
|
|
345
|
-
const executeSlide = (
|
|
406
|
+
const executeSlide = (slideInfo, updateHandler) => {
|
|
346
407
|
let preLeft = slideDivLeft.value;
|
|
347
408
|
let preTop = slideDivTop.value;
|
|
348
|
-
|
|
349
|
-
|
|
409
|
+
taskManager.run(() => {
|
|
410
|
+
slideDivLeft.value = vertical ? 0 : -visibleInfo.start;
|
|
411
|
+
slideDivTop.value = vertical ? -visibleInfo.start : 0;
|
|
412
|
+
return () => {
|
|
413
|
+
slideDivLeft.value = preLeft;
|
|
414
|
+
slideDivTop.value = preTop;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
350
417
|
let viewSlid = preLeft != slideDivLeft.value || preTop != slideDivTop.value;
|
|
351
|
-
visibleInfo.start = -target;
|
|
352
|
-
const updater = pageUpdater.update(
|
|
353
|
-
metroTemplate,
|
|
354
|
-
visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
|
|
355
|
-
Math.min(
|
|
356
|
-
visibleInfo.startMax +
|
|
357
|
-
visibleInfo.range +
|
|
358
|
-
visibleInfo.padding.end -
|
|
359
|
-
1,
|
|
360
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
361
|
-
),
|
|
362
|
-
focusId,
|
|
363
|
-
true,
|
|
364
|
-
permanentItemList
|
|
365
|
-
);
|
|
366
418
|
if (slideInfo.animObj) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
419
|
+
updateHandler.applyTmp();
|
|
420
|
+
taskManager.run(() => {
|
|
421
|
+
const from = vertical ? [0, preTop - slideDivTop.value] : [preLeft - slideDivLeft.value, 0];
|
|
422
|
+
const cancel = animationManager.startSlideAnim(
|
|
423
|
+
slideDiv.value,
|
|
424
|
+
from,
|
|
425
|
+
[0, 0],
|
|
426
|
+
{
|
|
427
|
+
...slideInfo.animObj,
|
|
428
|
+
onEnd: () => {
|
|
429
|
+
updateHandler.apply()
|
|
430
|
+
}
|
|
376
431
|
}
|
|
377
|
-
|
|
432
|
+
);
|
|
433
|
+
return () => {
|
|
434
|
+
cancel()
|
|
435
|
+
}
|
|
436
|
+
});
|
|
378
437
|
} else {
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
438
|
+
updateHandler.apply();
|
|
439
|
+
}
|
|
440
|
+
taskManager.run(() => {
|
|
441
|
+
const handler = setTimeout(() => {
|
|
442
|
+
_onScroll();
|
|
443
|
+
}, 0);
|
|
444
|
+
return () => {
|
|
445
|
+
clearTimeout(handler);
|
|
446
|
+
}
|
|
447
|
+
})
|
|
382
448
|
return viewSlid
|
|
383
449
|
}
|
|
384
450
|
|
|
385
|
-
const onMacroEndTaskBreak = (list) => {
|
|
386
|
-
if (list) {
|
|
387
|
-
list.forEach(task => {
|
|
388
|
-
if (task.type == TaskType.RESIZE_ITEM) {
|
|
389
|
-
metroTemplate.updateItemSize(task.params.index, {
|
|
390
|
-
width: task.params.width,
|
|
391
|
-
height: task.params.height,
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
})
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
const macroEndTaskManager = new MacroEndTaskManager(onMacroTaskEnd, onMacroEndTaskBreak);
|
|
398
|
-
|
|
399
451
|
const updateItemSize = (index, newSize, animInfo) => {
|
|
400
|
-
|
|
452
|
+
taskManager.addTask(TaskType.RESIZE_ITEM,
|
|
401
453
|
{
|
|
402
454
|
index,
|
|
403
455
|
width: newSize.width,
|
|
@@ -406,11 +458,11 @@ export const setup = (
|
|
|
406
458
|
});
|
|
407
459
|
}
|
|
408
460
|
|
|
409
|
-
const _slideTo = (target, animObj) => {
|
|
461
|
+
const _slideTo = (target, animObj, updateParam = { mergeTmp: false }) => {
|
|
410
462
|
if (slideLock) {
|
|
411
463
|
return
|
|
412
464
|
};
|
|
413
|
-
|
|
465
|
+
taskManager.addTask(TaskType.SLIDE, { target: -target, animObj, updateParam });
|
|
414
466
|
};
|
|
415
467
|
|
|
416
468
|
let callFocusAfterUpdate = false;
|
|
@@ -630,20 +682,8 @@ export const setup = (
|
|
|
630
682
|
templateItemAdder.tryAddItemByPosition(position);
|
|
631
683
|
if (
|
|
632
684
|
typeof position !== "undefined" &&
|
|
633
|
-
position != null
|
|
634
|
-
visibleInfo.start !== position
|
|
685
|
+
position != null
|
|
635
686
|
) {
|
|
636
|
-
visibleInfo.start = position;
|
|
637
|
-
|
|
638
|
-
const updater = pageUpdater.update(
|
|
639
|
-
metroTemplate,
|
|
640
|
-
visibleInfo.startWithPadding,
|
|
641
|
-
visibleInfo.endWithPadding,
|
|
642
|
-
focusId,
|
|
643
|
-
false,
|
|
644
|
-
permanentItemList
|
|
645
|
-
);
|
|
646
|
-
|
|
647
687
|
let animObj = null;
|
|
648
688
|
if (doAnim) {
|
|
649
689
|
animObj = {
|
|
@@ -651,15 +691,9 @@ export const setup = (
|
|
|
651
691
|
onStart: null,
|
|
652
692
|
speed: props.slideSetting.Speed,
|
|
653
693
|
duration: props.slideSetting.Duration,
|
|
654
|
-
onEnd: () => {
|
|
655
|
-
updater.apply();
|
|
656
|
-
},
|
|
657
694
|
};
|
|
658
|
-
pageUpdater.applyTmp();
|
|
659
|
-
} else {
|
|
660
|
-
pageUpdater.apply();
|
|
661
695
|
}
|
|
662
|
-
_slideTo(
|
|
696
|
+
_slideTo(position, animObj);
|
|
663
697
|
}
|
|
664
698
|
};
|
|
665
699
|
|
|
@@ -1261,31 +1295,17 @@ export const setup = (
|
|
|
1261
1295
|
|
|
1262
1296
|
let cur_slide = _calculateVisibleStart(fakeItem.templateInfo, direction);
|
|
1263
1297
|
if (cur_slide != visibleInfo.start) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
visibleInfo.padding.end -
|
|
1272
|
-
1,
|
|
1273
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
1274
|
-
),
|
|
1275
|
-
focusId,
|
|
1276
|
-
true,
|
|
1277
|
-
permanentItemList
|
|
1278
|
-
);
|
|
1279
|
-
updater.applyTmp();
|
|
1280
|
-
_slideTo(visibleInfo.start, {
|
|
1281
|
-
easing: "",
|
|
1282
|
-
onStart: null,
|
|
1283
|
-
speed: props.slideSetting.Speed,
|
|
1284
|
-
duration: props.slideSetting.Duration,
|
|
1285
|
-
onEnd: () => {
|
|
1286
|
-
updater.apply();
|
|
1298
|
+
_slideTo(
|
|
1299
|
+
cur_slide,
|
|
1300
|
+
{
|
|
1301
|
+
easing: "",
|
|
1302
|
+
onStart: null,
|
|
1303
|
+
speed: props.slideSetting.Speed,
|
|
1304
|
+
duration: props.slideSetting.Duration,
|
|
1287
1305
|
},
|
|
1288
|
-
|
|
1306
|
+
{
|
|
1307
|
+
mergeTmp: true
|
|
1308
|
+
});
|
|
1289
1309
|
return true;
|
|
1290
1310
|
}
|
|
1291
1311
|
}
|
|
@@ -1296,7 +1316,7 @@ export const setup = (
|
|
|
1296
1316
|
preFocusId = cache_pre ? focusId : -1;
|
|
1297
1317
|
focusId = id;
|
|
1298
1318
|
currentFocusIndex.value = id2Index(id);
|
|
1299
|
-
|
|
1319
|
+
taskManager.addTask(TaskType.ON_FOCUS_CHANGE);
|
|
1300
1320
|
}
|
|
1301
1321
|
|
|
1302
1322
|
const _bubbleCustomEvent = (event) => {
|
|
@@ -1384,32 +1404,13 @@ export const setup = (
|
|
|
1384
1404
|
let cur_visible_start = _calculateVisibleStart(next_focus_item.templateInfo, vertical ? vertical_direction : horizontal_direction);
|
|
1385
1405
|
if (visibleInfo.start !== cur_visible_start) {
|
|
1386
1406
|
if (next_focus_item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
|
|
1387
|
-
visibleInfo.start = cur_visible_start;
|
|
1388
|
-
const updater = pageUpdater.update(
|
|
1389
|
-
metroTemplate,
|
|
1390
|
-
visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
|
|
1391
|
-
Math.min(
|
|
1392
|
-
visibleInfo.startMax +
|
|
1393
|
-
visibleInfo.range +
|
|
1394
|
-
visibleInfo.padding.end -
|
|
1395
|
-
1,
|
|
1396
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
1397
|
-
),
|
|
1398
|
-
next_focus_item.id,
|
|
1399
|
-
false,
|
|
1400
|
-
permanentItemList
|
|
1401
|
-
);
|
|
1402
|
-
updater.applyTmp();
|
|
1403
1407
|
let animObj = {
|
|
1404
1408
|
easing: "",
|
|
1405
1409
|
onStart: null,
|
|
1406
1410
|
speed: props.slideSetting.Speed,
|
|
1407
1411
|
duration: props.slideSetting.Duration,
|
|
1408
|
-
onEnd: (animDone) => {
|
|
1409
|
-
updater.apply();
|
|
1410
|
-
},
|
|
1411
1412
|
};
|
|
1412
|
-
_slideTo(
|
|
1413
|
+
_slideTo(cur_visible_start, animObj, { mergeTmp: false });
|
|
1413
1414
|
} else {
|
|
1414
1415
|
const updater = pageUpdater.update(
|
|
1415
1416
|
metroTemplate,
|
|
@@ -1731,11 +1732,16 @@ export const setup = (
|
|
|
1731
1732
|
const reachAnchorGroup = 2;
|
|
1732
1733
|
const wallConditionGroup = 1;
|
|
1733
1734
|
|
|
1735
|
+
let divPos = -1;
|
|
1736
|
+
let frameCount = -1;
|
|
1734
1737
|
const getVisibleStart = (moveInfo) => {
|
|
1738
|
+
if (frameCount != Forge.sFrameCount.count) {
|
|
1739
|
+
divPos = vertical ? slideDivTop.value : slideDivLeft.value;
|
|
1740
|
+
}
|
|
1735
1741
|
if (vertical) {
|
|
1736
|
-
return -(
|
|
1742
|
+
return -(divPos + Math.round(moveInfo.yPos));
|
|
1737
1743
|
} else {
|
|
1738
|
-
return -(
|
|
1744
|
+
return -(divPos + Math.round(moveInfo.xPos));
|
|
1739
1745
|
}
|
|
1740
1746
|
}
|
|
1741
1747
|
|
|
@@ -1762,10 +1768,28 @@ export const setup = (
|
|
|
1762
1768
|
mode.touchStart();
|
|
1763
1769
|
mode.flingEnd();
|
|
1764
1770
|
|
|
1771
|
+
const t = 100;
|
|
1772
|
+
const offsetThreshold = {
|
|
1773
|
+
left: vertical ? undefined : t,
|
|
1774
|
+
right: vertical ? undefined : t,
|
|
1775
|
+
top: vertical ? t : undefined,
|
|
1776
|
+
bottom: vertical ? t : undefined,
|
|
1777
|
+
}
|
|
1778
|
+
actorController.run([
|
|
1779
|
+
actorController
|
|
1780
|
+
.condition(undefined, false)
|
|
1781
|
+
.offsetPosition(offsetThreshold.left, offsetThreshold.top, offsetThreshold.right, offsetThreshold.bottom)
|
|
1782
|
+
.then([actorController.state().touchLockSwitch(true, vertical ? 1 : 2, t)]),
|
|
1783
|
+
actorController
|
|
1784
|
+
.condition(undefined, false)
|
|
1785
|
+
.startMove(true, true)
|
|
1786
|
+
.then([onDragStart]),
|
|
1787
|
+
])
|
|
1788
|
+
|
|
1765
1789
|
//blur item
|
|
1766
1790
|
onItemBlur(getItemById(focusId));
|
|
1767
1791
|
|
|
1768
|
-
visibleInfo.start = getVisibleStart(data);
|
|
1792
|
+
// visibleInfo.start = getVisibleStart(data);
|
|
1769
1793
|
templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
|
|
1770
1794
|
|
|
1771
1795
|
const updater = pageUpdater.update(
|
|
@@ -1803,7 +1827,6 @@ export const setup = (
|
|
|
1803
1827
|
const onTouchRelease = () => {
|
|
1804
1828
|
if (mode.getTouchState() == TouchState.TAP) {
|
|
1805
1829
|
//只点击, 没有移动或者fling
|
|
1806
|
-
mergeTouchSlideToSlideDiv();
|
|
1807
1830
|
updateRenderItems(false, false);
|
|
1808
1831
|
mode.touchEnd();
|
|
1809
1832
|
}
|
|
@@ -1816,7 +1839,6 @@ export const setup = (
|
|
|
1816
1839
|
|
|
1817
1840
|
const onDragEnd = (data) => {
|
|
1818
1841
|
visibleInfo.start = getVisibleStart(data);
|
|
1819
|
-
|
|
1820
1842
|
actorController.run([
|
|
1821
1843
|
actorController.state().removeConditionByGroup(reachAnchorGroup),
|
|
1822
1844
|
]);
|
|
@@ -1905,10 +1927,10 @@ export const setup = (
|
|
|
1905
1927
|
.condition(undefined, true)
|
|
1906
1928
|
.onTouchDown()
|
|
1907
1929
|
.then([onTouchDown]),
|
|
1908
|
-
actorController
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1930
|
+
// actorController
|
|
1931
|
+
// .condition(undefined, true)
|
|
1932
|
+
// .onDragStart()
|
|
1933
|
+
// .then([onDragStart]),
|
|
1912
1934
|
actorController
|
|
1913
1935
|
.condition(undefined, true)
|
|
1914
1936
|
.onDragEnd()
|
|
@@ -1925,6 +1947,10 @@ export const setup = (
|
|
|
1925
1947
|
.condition(undefined, true)
|
|
1926
1948
|
.onFlingEnd()
|
|
1927
1949
|
.then([onFlingEnd]),
|
|
1950
|
+
actorController
|
|
1951
|
+
.condition(undefined, true)
|
|
1952
|
+
.onTouchRelease()
|
|
1953
|
+
.then([actorController.state().touchLockSwitch(false, vertical ? 1 : 2)]),
|
|
1928
1954
|
|
|
1929
1955
|
actorController
|
|
1930
1956
|
.condition(wallConditionGroup, true)
|
|
@@ -1979,7 +2005,7 @@ export const setup = (
|
|
|
1979
2005
|
focusId = init_focus_id;
|
|
1980
2006
|
visibleInfo.start = cur_visible_start;
|
|
1981
2007
|
|
|
1982
|
-
const
|
|
2008
|
+
const initUpdater = pageUpdater.update(
|
|
1983
2009
|
metroTemplate,
|
|
1984
2010
|
visibleInfo.startWithPadding,
|
|
1985
2011
|
visibleInfo.endWithPadding,
|
|
@@ -1987,7 +2013,7 @@ export const setup = (
|
|
|
1987
2013
|
false,
|
|
1988
2014
|
permanentItemList
|
|
1989
2015
|
);
|
|
1990
|
-
|
|
2016
|
+
initUpdater.apply();
|
|
1991
2017
|
|
|
1992
2018
|
onMounted(() => {
|
|
1993
2019
|
_changeFocusId(focusId, false);
|
|
@@ -2004,7 +2030,7 @@ export const setup = (
|
|
|
2004
2030
|
itemRender.value = true;
|
|
2005
2031
|
});
|
|
2006
2032
|
}
|
|
2007
|
-
if (props.
|
|
2033
|
+
if (props.touchFlag === 1) {
|
|
2008
2034
|
initTouch();
|
|
2009
2035
|
}
|
|
2010
2036
|
});
|
|
@@ -2027,5 +2053,6 @@ export const setup = (
|
|
|
2027
2053
|
onTouchDown,
|
|
2028
2054
|
onTouchRelease,
|
|
2029
2055
|
currentFocusIndex,
|
|
2056
|
+
modeForExport,
|
|
2030
2057
|
}
|
|
2031
2058
|
}
|
|
@@ -32,7 +32,7 @@ export class PageUpdater {
|
|
|
32
32
|
mergeTmp: boolean,
|
|
33
33
|
permanentList: Array<PermanentItemInfo> | null,
|
|
34
34
|
extensionRange: number = 0
|
|
35
|
-
): {apply: Function, applyTmp: Function} {
|
|
35
|
+
): { apply: Function, applyTmp: Function, recover: Function } {
|
|
36
36
|
this.count++;
|
|
37
37
|
const [visibleStart, visibleEnd] = template.getVisibleItemList(
|
|
38
38
|
start - extensionRange,
|
|
@@ -63,13 +63,14 @@ export class PageUpdater {
|
|
|
63
63
|
this.rangeSet.add(pItem.index);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
|
|
66
67
|
if (preRangeSet.size > 0) {
|
|
67
68
|
this.tmpRangeSet = new Set([...this.rangeSet, ...preRangeSet]);
|
|
68
69
|
}
|
|
70
|
+
|
|
69
71
|
if (mergeTmp) {
|
|
70
72
|
this.tmpRangeSet = new Set([...this.tmpRangeSet, ...preTmpRangeSet]);
|
|
71
73
|
}
|
|
72
|
-
|
|
73
74
|
const c = this.count;
|
|
74
75
|
return {
|
|
75
76
|
apply: () => {
|
|
@@ -86,11 +87,14 @@ export class PageUpdater {
|
|
|
86
87
|
// console.log("apply tmp expired data")
|
|
87
88
|
}
|
|
88
89
|
},
|
|
90
|
+
recover: () => {
|
|
91
|
+
this.rangeSet = preRangeSet;
|
|
92
|
+
this.tmpRangeSet = preTmpRangeSet;
|
|
93
|
+
}
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
private apply(): void {
|
|
93
|
-
this.tmpRangeSet.clear();
|
|
94
98
|
this.updateFunc(this.rangeSet);
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -26,7 +26,7 @@ interface CustomerCallbackMap {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class RenderItem {
|
|
29
|
-
private divMountedCallback:
|
|
29
|
+
private divMountedCallback: Set<(div: HTMLDivElement) => void> = new Set();
|
|
30
30
|
|
|
31
31
|
public customerData: object;
|
|
32
32
|
public templateInfo: TemplateItem;
|
|
@@ -137,18 +137,21 @@ export class RenderItem {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
public addDivMountedListener(cbk: (div: HTMLDivElement) => void) {
|
|
140
|
-
this.divMountedCallback.
|
|
140
|
+
this.divMountedCallback.add(cbk);
|
|
141
|
+
return () => {
|
|
142
|
+
this.divMountedCallback.delete(cbk);
|
|
143
|
+
}
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
private onDivMounted(): void {
|
|
144
|
-
if (this.divMountedCallback.
|
|
147
|
+
if (this.divMountedCallback.size > 0) {
|
|
145
148
|
this.divMountedCallback.forEach((cbk: (ele: HTMLDivElement) => void) => {
|
|
146
149
|
if (this.rootDiv) {
|
|
147
150
|
cbk(this.rootDiv);
|
|
148
151
|
}
|
|
149
152
|
})
|
|
150
153
|
}
|
|
151
|
-
this.divMountedCallback
|
|
154
|
+
this.divMountedCallback.clear();
|
|
152
155
|
if (this.enableTap && this.rootDiv) {
|
|
153
156
|
const divView = (this.rootDiv as any).jsvGetProxyView();
|
|
154
157
|
divView.DragEnables?.(0x01); // 只激活tap
|
|
@@ -157,6 +160,6 @@ export class RenderItem {
|
|
|
157
160
|
|
|
158
161
|
private onDivUnmounted(): void {
|
|
159
162
|
this.touchInit = false;
|
|
160
|
-
this.divMountedCallback
|
|
163
|
+
this.divMountedCallback.clear();
|
|
161
164
|
}
|
|
162
165
|
}
|