@shijiu/jsview-vue 2.1.25 → 2.1.200
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 +1 -1
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +1 -1
- package/utils/JsViewEngineWidget/JsvFocusHub.ts +123 -0
- package/utils/JsViewEngineWidget/JsvFocusManager.js +4 -3
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +145 -51
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +51 -64
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +62 -71
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +308 -613
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +127 -247
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +1 -0
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +36 -2
- package/utils/JsViewEngineWidget/WidgetCommon.ts +25 -6
- package/utils/JsViewPlugin/JsvAudio/{JsvAudioBrowser.vue → BrowserAudio/BrowserAudio.vue} +1 -1
- package/utils/JsViewPlugin/JsvAudio/index.js +1 -1
- package/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.js +37 -0
- package/utils/JsViewPlugin/JsvLatex/Color.ts +43 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +159 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.js +16 -0
- package/utils/JsViewPlugin/JsvLatex/JsvLatexBrowser.vue +59 -0
- package/utils/JsViewPlugin/JsvLatex/PluginLoader.js +171 -0
- package/utils/JsViewPlugin/JsvLatex/index.js +28 -0
- package/utils/JsViewPlugin/JsvLatex/mathjax-tex-svg.txt +1 -0
- package/utils/JsViewPlugin/JsvLatex/version.js +24 -0
- package/utils/JsViewPlugin/JsvLatex/version.mjs +24 -0
- package/utils/JsViewPlugin/index.js +2 -1
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +2 -52
- package/utils/JsViewVueTools/JsvPerformance.ts +11 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +55 -11
- package/utils/JsViewVueTools/JsvStyleSheetsDeclarer.js +40 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +143 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +24 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +198 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +31 -0
- package/utils/JsViewVueTools/JsvTextureStore/Store.ts +32 -0
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +38 -0
- package/utils/JsViewVueTools/index.js +3 -0
- package/utils/JsViewVueWidget/JsvEnableRenderBreak.vue +17 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.ts +6 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +144 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.ts +6 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/{CallbackManager.js → CallbackManager.ts} +19 -10
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +45 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue +124 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/KeepFlags.ts +6 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +553 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +138 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +53 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +11 -1
- package/utils/JsViewVueWidget/JsvHole.js +1 -1
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +101 -0
- package/utils/JsViewVueWidget/JsvLine/LineManager.js +62 -0
- package/utils/JsViewVueWidget/JsvLine/index.js +3 -0
- package/utils/JsViewVueWidget/JsvMarquee.vue +316 -139
- package/utils/JsViewVueWidget/JsvMindMap/CommonType.ts +1 -0
- package/utils/JsViewVueWidget/JsvMindMap/Constant.ts +20 -0
- package/utils/JsViewVueWidget/JsvMindMap/DataTree.ts +394 -0
- package/utils/JsViewVueWidget/JsvMindMap/Geometry.ts +277 -0
- package/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue +653 -0
- package/utils/JsViewVueWidget/JsvMindMap/index.js +1 -0
- package/utils/JsViewVueWidget/JsvMindMap/rtree.js +628 -0
- package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
- package/utils/JsViewVueWidget/JsvPieChart.vue +124 -0
- package/utils/JsViewVueWidget/JsvPosterImage.vue +32 -9
- package/utils/JsViewVueWidget/JsvPreload/BrowserPreload.vue +135 -133
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +273 -270
- package/utils/JsViewVueWidget/JsvSector.vue +107 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +14 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +28 -2
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +122 -93
- package/utils/JsViewVueWidget/index.js +15 -7
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.js +0 -112
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CommonTools.js +0 -18
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.js +0 -216
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.js +0 -66
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.js +0 -38
- package/utils/JsViewVueWidget/JsvFreeMoveActor/TypeDefine.js +0 -12
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +0 -183
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +0 -87
- /package/utils/{JsViewVueWidget → JsViewPlugin/JsvAudio/BrowserAudio}/JsvSystemAudio.vue +0 -0
|
@@ -277,6 +277,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
277
277
|
templateItem.top = yPos;
|
|
278
278
|
templateItem.centerXPos = Math.floor(xPos + xWidth / 2) - 1;
|
|
279
279
|
templateItem.centerYPos = Math.floor(yPos + yWidth / 2) - 1;
|
|
280
|
+
|
|
280
281
|
//分页相关的计算
|
|
281
282
|
let curPageNumber = 0;
|
|
282
283
|
let curPageHeadIndex = 0;
|
|
@@ -305,6 +306,24 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
305
306
|
templateItem.pageNumber = curPageNumber;
|
|
306
307
|
templateItem.pageHeadIndex = curPageHeadIndex;
|
|
307
308
|
this.addTemplateItem(templateItem);
|
|
309
|
+
|
|
310
|
+
//记录尾元素
|
|
311
|
+
if (this.tailItemIndex < 0) {
|
|
312
|
+
this.tailItemIndex = templateItem.index;
|
|
313
|
+
} else {
|
|
314
|
+
let pre: number, cur: number;
|
|
315
|
+
if (this.direction === VERTICAL) {
|
|
316
|
+
cur = templateItem.height + templateItem.top;
|
|
317
|
+
pre = this.templateList[this.tailItemIndex].height + this.templateList[this.tailItemIndex].top;
|
|
318
|
+
} else {
|
|
319
|
+
cur = templateItem.width + templateItem.left;
|
|
320
|
+
pre = this.templateList[this.tailItemIndex].width + this.templateList[this.tailItemIndex].left;
|
|
321
|
+
}
|
|
322
|
+
if (cur >= pre) {
|
|
323
|
+
this.tailItemIndex = templateItem.index;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
308
327
|
// 计算相邻项
|
|
309
328
|
this._TryCalculateNeighborItem(
|
|
310
329
|
this.templateList.length - 1,
|
|
@@ -396,7 +415,8 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
396
415
|
let nextTemplateItem = this.getNextItemInner(
|
|
397
416
|
itemIndex,
|
|
398
417
|
offset,
|
|
399
|
-
vOffset !== 0
|
|
418
|
+
vOffset !== 0,
|
|
419
|
+
this.supportHistoryPath
|
|
400
420
|
);
|
|
401
421
|
const isVertical = this.direction === VERTICAL;
|
|
402
422
|
|
|
@@ -444,50 +464,61 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
444
464
|
}
|
|
445
465
|
|
|
446
466
|
|
|
447
|
-
private getNextItemInner(index: number, offset: number,
|
|
467
|
+
private getNextItemInner(index: number, offset: number,
|
|
468
|
+
vertical: boolean, useHistory: boolean, checkAnchor: number = -1) {
|
|
448
469
|
const templateList = this.templateList;
|
|
449
470
|
const baseItem = templateList[index];
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
471
|
+
if (checkAnchor < 0) {
|
|
472
|
+
// let checkAnchor = -1;
|
|
473
|
+
if (baseItem.findNextAnchor) {
|
|
474
|
+
//有自定义的 anchor
|
|
475
|
+
// TODO 优化
|
|
476
|
+
if (vertical) {
|
|
477
|
+
if (offset > 0) {
|
|
478
|
+
if (baseItem.findNextAnchor.bottom) {
|
|
479
|
+
checkAnchor =
|
|
480
|
+
baseItem.left +
|
|
481
|
+
baseItem.findNextAnchor.bottom *
|
|
482
|
+
(baseItem.width + baseItem.marginRight);
|
|
483
|
+
}
|
|
484
|
+
} else {
|
|
485
|
+
if (baseItem.findNextAnchor.top) {
|
|
486
|
+
checkAnchor =
|
|
487
|
+
baseItem.left +
|
|
488
|
+
baseItem.findNextAnchor.top *
|
|
489
|
+
(baseItem.width + baseItem.marginRight);
|
|
490
|
+
}
|
|
461
491
|
}
|
|
462
492
|
} else {
|
|
463
|
-
if (
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
493
|
+
if (offset > 0) {
|
|
494
|
+
if (baseItem.findNextAnchor.right) {
|
|
495
|
+
checkAnchor =
|
|
496
|
+
baseItem.top +
|
|
497
|
+
baseItem.findNextAnchor.right *
|
|
498
|
+
(baseItem.height + baseItem.marginBottom);
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
if (baseItem.findNextAnchor.left) {
|
|
502
|
+
checkAnchor =
|
|
503
|
+
baseItem.top +
|
|
504
|
+
baseItem.findNextAnchor.left *
|
|
505
|
+
(baseItem.height + baseItem.marginBottom);
|
|
506
|
+
}
|
|
468
507
|
}
|
|
469
508
|
}
|
|
509
|
+
}
|
|
510
|
+
if (checkAnchor < 0) {
|
|
511
|
+
checkAnchor = vertical ? baseItem.centerXPos : baseItem.centerYPos;
|
|
512
|
+
}
|
|
513
|
+
} else {
|
|
514
|
+
// checkAncher可能在baseItem的范围之外, 将其调整至自身范围内
|
|
515
|
+
if (vertical) {
|
|
516
|
+
checkAnchor = Math.max(Math.min(checkAnchor, baseItem.left + baseItem.width - 1), baseItem.left)
|
|
470
517
|
} else {
|
|
471
|
-
|
|
472
|
-
if (baseItem.findNextAnchor.right) {
|
|
473
|
-
checkAnchor =
|
|
474
|
-
baseItem.top +
|
|
475
|
-
baseItem.findNextAnchor.right *
|
|
476
|
-
(baseItem.height + baseItem.marginBottom);
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
if (baseItem.findNextAnchor.left) {
|
|
480
|
-
checkAnchor =
|
|
481
|
-
baseItem.top +
|
|
482
|
-
baseItem.findNextAnchor.left *
|
|
483
|
-
(baseItem.height + baseItem.marginBottom);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
518
|
+
checkAnchor = Math.max(Math.min(checkAnchor, baseItem.top + baseItem.height - 1), baseItem.top)
|
|
486
519
|
}
|
|
487
520
|
}
|
|
488
|
-
|
|
489
|
-
checkAnchor = vertical ? baseItem.centerXPos : baseItem.centerYPos;
|
|
490
|
-
}
|
|
521
|
+
|
|
491
522
|
const posKey = vertical ? "left" : "top";
|
|
492
523
|
const sizeKey = vertical ? "width" : "height";
|
|
493
524
|
let direction = vertical ? "top" : "left";
|
|
@@ -512,7 +543,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
512
543
|
let found = false;
|
|
513
544
|
let nextIndex = -1;
|
|
514
545
|
let pathHistoryIndex = -1;
|
|
515
|
-
if (
|
|
546
|
+
if (useHistory && !baseItem.findNextAnchor) {
|
|
516
547
|
pathHistoryIndex = templateList[index].pathHistory[direction];
|
|
517
548
|
}
|
|
518
549
|
if (pathHistoryIndex < 0) {
|
|
@@ -600,7 +631,7 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
600
631
|
if (found) {
|
|
601
632
|
if (!templateList[nextIndex].focusable) {
|
|
602
633
|
// 如果是占位符,则查找占位符的下一个
|
|
603
|
-
return this.getNextItemInner(nextIndex, offset, vertical);
|
|
634
|
+
return this.getNextItemInner(nextIndex, offset, vertical, false, checkAnchor);
|
|
604
635
|
}
|
|
605
636
|
return templateList[nextIndex];
|
|
606
637
|
}
|
|
@@ -723,6 +754,12 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
723
754
|
console.error(TAG, "updateItemSize is not supported.");
|
|
724
755
|
}
|
|
725
756
|
|
|
757
|
+
static intersects(s0: number, e0: number, s1: number, e1: number): boolean {
|
|
758
|
+
return s0 <= e1 && s1 <= e0;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
static iterCount = 0;
|
|
762
|
+
|
|
726
763
|
/** get visible item list functions */
|
|
727
764
|
public getVisibleItemList(
|
|
728
765
|
visibleStart: number,
|
|
@@ -732,229 +769,72 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
732
769
|
// No visible item
|
|
733
770
|
return [-1, -1];
|
|
734
771
|
}
|
|
735
|
-
|
|
772
|
+
|
|
736
773
|
visibleStart = Math.round(visibleStart);
|
|
737
774
|
visibleEnd = Math.round(visibleEnd);
|
|
738
775
|
let searchBaseItemIdx = this.id2Index(baseId);
|
|
739
776
|
if (searchBaseItemIdx < 0) searchBaseItemIdx = 0;
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
enableBackwardSearching: true,
|
|
744
|
-
enableForwardSearching: true,
|
|
745
|
-
checkingStartLinePos: visibleStart,
|
|
746
|
-
checkingEndLinePos: visibleEnd,
|
|
747
|
-
};
|
|
748
|
-
const backwardConfigure: VisibleSearchConfig = {
|
|
749
|
-
searchDirect: -1,
|
|
750
|
-
baseIdx: searchBaseItemIdx,
|
|
751
|
-
checkingStartLineRanges: new RangesModel(0, 0),
|
|
752
|
-
startLineRangesFulled: false,
|
|
753
|
-
latestOverStartLineIdx: -1,
|
|
754
|
-
checkingEndLineRanges: new RangesModel(0, 0),
|
|
755
|
-
endLineRangesFulled: false,
|
|
756
|
-
latestOverEndLineIdx: -1,
|
|
757
|
-
endSearchingIndex: 0,
|
|
758
|
-
firstStartLineBlockIdx: -1,
|
|
759
|
-
firstEndLineBlockIdx: -1,
|
|
760
|
-
searchToBorder: false,
|
|
761
|
-
common: commonData,
|
|
762
|
-
};
|
|
763
|
-
const forwardConfigure: VisibleSearchConfig = {
|
|
764
|
-
searchDirect: 1,
|
|
765
|
-
baseIdx: searchBaseItemIdx,
|
|
766
|
-
checkingStartLineRanges: new RangesModel(0, 0),
|
|
767
|
-
startLineRangesFulled: false,
|
|
768
|
-
latestOverStartLineIdx: -1,
|
|
769
|
-
checkingEndLineRanges: new RangesModel(0, 0),
|
|
770
|
-
endLineRangesFulled: false,
|
|
771
|
-
latestOverEndLineIdx: -1,
|
|
772
|
-
endSearchingIndex: this.templateList.length - 1,
|
|
773
|
-
firstStartLineBlockIdx: -1,
|
|
774
|
-
firstEndLineBlockIdx: -1,
|
|
775
|
-
searchToBorder: false,
|
|
776
|
-
common: commonData,
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
const isTemplateVertical = this.direction === VERTICAL;
|
|
780
|
-
let offset = 0;
|
|
781
|
-
while (
|
|
782
|
-
commonData.enableBackwardSearching ||
|
|
783
|
-
commonData.enableForwardSearching
|
|
784
|
-
) {
|
|
785
|
-
if (commonData.enableBackwardSearching) {
|
|
786
|
-
this._DoSearching(backwardConfigure, -offset, isTemplateVertical);
|
|
787
|
-
}
|
|
777
|
+
const vertical = this.direction === VERTICAL;
|
|
778
|
+
const sizeKey = vertical ? "height" : "width";
|
|
779
|
+
const posKey = vertical ? "top" : "left"
|
|
788
780
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
}
|
|
792
|
-
offset++;
|
|
781
|
+
const visible = (s: number, e: number) => {
|
|
782
|
+
return CommonMetroTemplate.intersects(visibleStart, visibleEnd, s, e);
|
|
793
783
|
}
|
|
794
|
-
// console.log(
|
|
795
|
-
// "GetVisibleItemList [" +
|
|
796
|
-
// JSON.stringify(commonData) +
|
|
797
|
-
// ", " +
|
|
798
|
-
// JSON.stringify(backwardConfigure) +
|
|
799
|
-
// ", " +
|
|
800
|
-
// JSON.stringify(forwardConfigure) +
|
|
801
|
-
// "]"
|
|
802
|
-
// );
|
|
803
784
|
|
|
804
|
-
|
|
805
|
-
// When start index not found
|
|
806
|
-
// Use just over start line block as start idx
|
|
807
|
-
if (
|
|
808
|
-
backwardConfigure.latestOverStartLineIdx >= 0 &&
|
|
809
|
-
backwardConfigure.firstStartLineBlockIdx >= 0
|
|
810
|
-
)
|
|
811
|
-
commonData.resultStartIdx = backwardConfigure.latestOverStartLineIdx;
|
|
812
|
-
else if (forwardConfigure.firstStartLineBlockIdx >= 0)
|
|
813
|
-
commonData.resultStartIdx = forwardConfigure.firstStartLineBlockIdx;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
if (commonData.resultEndIdx < 0) {
|
|
817
|
-
// When end index not found
|
|
818
|
-
// Use just over end line block as end idx
|
|
819
|
-
if (
|
|
820
|
-
forwardConfigure.latestOverEndLineIdx >= 0 &&
|
|
821
|
-
forwardConfigure.firstEndLineBlockIdx >= 0
|
|
822
|
-
)
|
|
823
|
-
commonData.resultEndIdx = forwardConfigure.latestOverEndLineIdx;
|
|
824
|
-
else if (backwardConfigure.firstEndLineBlockIdx >= 0)
|
|
825
|
-
commonData.resultEndIdx = backwardConfigure.firstEndLineBlockIdx;
|
|
826
|
-
}
|
|
827
|
-
// Recheck if whole contents inside the range
|
|
828
|
-
if (commonData.resultStartIdx < 0 && commonData.resultEndIdx < 0) {
|
|
829
|
-
// Check if whole contents inside the range
|
|
830
|
-
const firstItem = this.templateList[0];
|
|
831
|
-
const firstSecondPos = isTemplateVertical
|
|
832
|
-
? firstItem.top
|
|
833
|
-
: firstItem.left;
|
|
834
|
-
const lastItem = this.templateList[this.templateList.length - 1];
|
|
835
|
-
const lastSecondPos = isTemplateVertical
|
|
836
|
-
? lastItem.top
|
|
837
|
-
: lastItem.left;
|
|
838
|
-
const lastSecondWidth = isTemplateVertical
|
|
839
|
-
? lastItem.height
|
|
840
|
-
: lastItem.width;
|
|
841
|
-
if (
|
|
842
|
-
firstSecondPos > visibleStart &&
|
|
843
|
-
lastSecondPos + lastSecondWidth < visibleEnd
|
|
844
|
-
) {
|
|
845
|
-
commonData.resultStartIdx = 0;
|
|
846
|
-
commonData.resultEndIdx = this.templateList.length - 1;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
let ret: [number, number] = [-1, -1];
|
|
850
|
-
if (commonData.resultStartIdx >= 0 || commonData.resultEndIdx >= 0) {
|
|
851
|
-
const startIdx =
|
|
852
|
-
commonData.resultStartIdx >= 0 ? commonData.resultStartIdx : 0;
|
|
853
|
-
const endIdx =
|
|
854
|
-
commonData.resultEndIdx >= 0
|
|
855
|
-
? commonData.resultEndIdx
|
|
856
|
-
: this.templateList.length - 1;
|
|
857
|
-
ret = [startIdx, endIdx];
|
|
858
|
-
}
|
|
859
|
-
return ret;
|
|
860
|
-
}
|
|
785
|
+
let baseItem = this.templateList[searchBaseItemIdx];
|
|
861
786
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
const keyPos = beVerticalTemplate ? checkItem.left : checkItem.top;
|
|
865
|
-
const keyWidth = beVerticalTemplate
|
|
866
|
-
? checkItem.width + checkItem.marginRight
|
|
867
|
-
: checkItem.height + checkItem.marginBottom;
|
|
868
|
-
const keyStart = Math.round(keyPos);
|
|
869
|
-
const keyEnd = Math.round(keyPos + keyWidth - 1);
|
|
870
|
-
const secondPos = beVerticalTemplate ? checkItem.top : checkItem.left;
|
|
871
|
-
const secondWidth = beVerticalTemplate
|
|
872
|
-
? checkItem.height + checkItem.marginBottom
|
|
873
|
-
: checkItem.width + checkItem.marginRight;
|
|
874
|
-
const secondStart = Math.round(secondPos);
|
|
875
|
-
const secondEnd = Math.round(secondPos + secondWidth - 1);
|
|
876
|
-
// console.log(
|
|
877
|
-
// "idx=" +
|
|
878
|
-
// (configures.baseIdx + offset) +
|
|
879
|
-
// " pos=" +
|
|
880
|
-
// secondPos +
|
|
881
|
-
// " posend=" +
|
|
882
|
-
// (secondPos + secondWidth - 1) +
|
|
883
|
-
// " linePos=" +
|
|
884
|
-
// configures.common.checkingStartLinePos
|
|
885
|
-
// );
|
|
787
|
+
//寻找首个在范围内的item
|
|
788
|
+
let startIndex = 0, endIndex = this.templateList.length - 1;
|
|
886
789
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
if (
|
|
893
|
-
secondStart <= configures.common.checkingStartLinePos &&
|
|
894
|
-
secondEnd >= configures.common.checkingStartLinePos
|
|
895
|
-
) {
|
|
896
|
-
// Overlap the visbible start line
|
|
897
|
-
configures.latestOverStartLineIdx = configures.baseIdx + offset;
|
|
898
|
-
if (configures.firstStartLineBlockIdx < 0)
|
|
899
|
-
configures.firstStartLineBlockIdx = configures.baseIdx + offset;
|
|
900
|
-
configures.checkingStartLineRanges.Merge(
|
|
901
|
-
new SingleRangeModel(keyStart, keyEnd)
|
|
902
|
-
);
|
|
903
|
-
isRangeChanged = true;
|
|
904
|
-
} else if (
|
|
905
|
-
configures.searchDirect < 0 &&
|
|
906
|
-
secondEnd <= configures.common.checkingStartLinePos
|
|
907
|
-
) {
|
|
908
|
-
// above the visible start line
|
|
909
|
-
configures.checkingStartLineRanges.Merge(
|
|
910
|
-
new SingleRangeModel(keyStart, keyEnd)
|
|
911
|
-
);
|
|
912
|
-
isRangeChanged = true;
|
|
790
|
+
while (baseItem && !visible(baseItem[posKey], baseItem[posKey] + baseItem[sizeKey])) {
|
|
791
|
+
if (baseItem[posKey] < visibleStart) {
|
|
792
|
+
startIndex = baseItem.index;
|
|
793
|
+
} else {
|
|
794
|
+
endIndex = baseItem.index;
|
|
913
795
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
secondEnd >= configures.common.checkingEndLinePos
|
|
930
|
-
) {
|
|
931
|
-
// Overlap the visbible end line
|
|
932
|
-
configures.latestOverEndLineIdx = configures.baseIdx + offset;
|
|
933
|
-
if (configures.firstEndLineBlockIdx < 0)
|
|
934
|
-
configures.firstEndLineBlockIdx = configures.baseIdx + offset;
|
|
935
|
-
configures.checkingEndLineRanges.Merge(
|
|
936
|
-
new SingleRangeModel(keyStart, keyEnd)
|
|
937
|
-
);
|
|
938
|
-
isRangeChanged = true;
|
|
939
|
-
} else if (
|
|
940
|
-
configures.searchDirect > 0 &&
|
|
941
|
-
secondStart >= configures.common.checkingEndLinePos
|
|
942
|
-
) {
|
|
943
|
-
// below the visible end line
|
|
944
|
-
configures.checkingEndLineRanges.Merge(
|
|
945
|
-
new SingleRangeModel(keyStart, keyEnd)
|
|
946
|
-
);
|
|
947
|
-
isRangeChanged = true;
|
|
796
|
+
if (Math.abs(startIndex - endIndex) <= 1) {
|
|
797
|
+
const tailItem = this.templateList[this.getTailItemIndex()];
|
|
798
|
+
let tailInfo: any = null;
|
|
799
|
+
if (tailItem) {
|
|
800
|
+
tailInfo = {
|
|
801
|
+
left: tailItem.left,
|
|
802
|
+
top: tailItem.top,
|
|
803
|
+
width: tailItem.width,
|
|
804
|
+
height: tailItem.height,
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
console.log("MetroWidget: can not find visible item", visibleStart, visibleEnd, tailInfo);
|
|
808
|
+
return [-1, -1];
|
|
809
|
+
} else {
|
|
810
|
+
baseItem = this.templateList[Math.round((startIndex + endIndex) / 2)];
|
|
948
811
|
}
|
|
949
812
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
813
|
+
|
|
814
|
+
CommonMetroTemplate.iterCount = 0;
|
|
815
|
+
|
|
816
|
+
let visibleItem: Set<number> = new Set();
|
|
817
|
+
visibleItem.add(baseItem.index);
|
|
818
|
+
const nKeys = ["left", "top", "bottom", "right"];
|
|
819
|
+
const addVisibleNeighbor = (targetItem: TemplateItem) => {
|
|
820
|
+
for (let key of nKeys) {
|
|
821
|
+
let n = this._GetTotalNeighbor(targetItem.index, key);
|
|
822
|
+
if (n && n.length > 0) {
|
|
823
|
+
for (let i of n) {
|
|
824
|
+
let item = this.templateList[i];
|
|
825
|
+
if (visible(item[posKey], item[posKey] + item[sizeKey]) && !visibleItem.has(i)) {
|
|
826
|
+
visibleItem.add(i);
|
|
827
|
+
addVisibleNeighbor(item);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
955
831
|
}
|
|
956
|
-
configures.searchToBorder = true;
|
|
957
832
|
}
|
|
833
|
+
addVisibleNeighbor(baseItem);
|
|
834
|
+
return [
|
|
835
|
+
Math.min(...visibleItem),
|
|
836
|
+
Math.max(...visibleItem),
|
|
837
|
+
]
|
|
958
838
|
}
|
|
959
839
|
|
|
960
840
|
/** neighbor calculate functions */
|
|
@@ -14,6 +14,7 @@ class ListMetroTemplate extends MetroTemplate {
|
|
|
14
14
|
public addItem(itemObj: MeasureInfo): TemplateItem {
|
|
15
15
|
const templateItem = MetroTemplate.getTemplateItem(itemObj);
|
|
16
16
|
this._addTemplateItem(templateItem);
|
|
17
|
+
this.tailItemIndex = templateItem.index;
|
|
17
18
|
return templateItem;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -159,6 +159,7 @@ interface TemplateItem {
|
|
|
159
159
|
bottom: number,
|
|
160
160
|
}
|
|
161
161
|
findNextAnchor: FindNextAnchor | null,
|
|
162
|
+
layoutCache: { top: number, left: number, width: number, height: number } | null,
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
interface MeasureInfo {
|
|
@@ -184,6 +185,8 @@ abstract class MetroTemplate {
|
|
|
184
185
|
public readonly lineMax: number;
|
|
185
186
|
public readonly pageSize: number;
|
|
186
187
|
public readonly layoutType: string;
|
|
188
|
+
protected tailItemIndex: number = -1;
|
|
189
|
+
private cachedLayoutRange: Array<[number, number]> = [];
|
|
187
190
|
|
|
188
191
|
constructor(direction: Symbol, lineMax: number, pageSize: number, layoutType: string, supportHistoryPath: boolean) {
|
|
189
192
|
this.idsMap = [];
|
|
@@ -217,7 +220,7 @@ abstract class MetroTemplate {
|
|
|
217
220
|
public index2Id(index: number): number {
|
|
218
221
|
const item = this.templateList[index];
|
|
219
222
|
if (typeof item == "undefined") {
|
|
220
|
-
console.
|
|
223
|
+
console.log(TAG, "index not exist", index, ", template length", this.templateList.length);
|
|
221
224
|
return -1;
|
|
222
225
|
} else {
|
|
223
226
|
return item.id
|
|
@@ -227,7 +230,7 @@ abstract class MetroTemplate {
|
|
|
227
230
|
public id2Index(id: number): number {
|
|
228
231
|
const index = this.idsMap[id];
|
|
229
232
|
if (typeof index == "undefined") {
|
|
230
|
-
console.
|
|
233
|
+
console.log(TAG, "id not exist", id);
|
|
231
234
|
return -1;
|
|
232
235
|
}
|
|
233
236
|
return index;
|
|
@@ -255,6 +258,36 @@ abstract class MetroTemplate {
|
|
|
255
258
|
public abstract updateItemSize(index: number,
|
|
256
259
|
newSize: { width: number, height: number }): void;
|
|
257
260
|
|
|
261
|
+
public getTailItemIndex() {
|
|
262
|
+
return this.tailItemIndex;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
public cacheLayout(start: number, end: number) {
|
|
266
|
+
if (typeof end == "undefined") {
|
|
267
|
+
end = this.templateList.length;
|
|
268
|
+
}
|
|
269
|
+
end = Math.min(end, this.templateList.length);
|
|
270
|
+
for (let i = start; i < end; ++i) {
|
|
271
|
+
let item = this.templateList[i];
|
|
272
|
+
item.layoutCache = {
|
|
273
|
+
left: item.left,
|
|
274
|
+
top: item.top,
|
|
275
|
+
width: item.width,
|
|
276
|
+
height: item.height,
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
this.cachedLayoutRange.push([start, end]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
public cleanLayoutCache() {
|
|
283
|
+
for (let r of this.cachedLayoutRange) {
|
|
284
|
+
for (let i = r[0]; i < r[1]; ++i) {
|
|
285
|
+
this.templateList[i].layoutCache = null;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
this.cachedLayoutRange = [];
|
|
289
|
+
}
|
|
290
|
+
|
|
258
291
|
protected static getTemplateItem(itemObj: MeasureInfo): TemplateItem {
|
|
259
292
|
const valid = this.checkMeasureObject(itemObj);
|
|
260
293
|
if (!valid) {
|
|
@@ -296,6 +329,7 @@ abstract class MetroTemplate {
|
|
|
296
329
|
top: -1,
|
|
297
330
|
bottom: -1,
|
|
298
331
|
},
|
|
332
|
+
layoutCache: null,
|
|
299
333
|
}
|
|
300
334
|
}
|
|
301
335
|
|
|
@@ -107,14 +107,20 @@ export class SlideSetting {
|
|
|
107
107
|
public static END_PROTECT = 2;
|
|
108
108
|
|
|
109
109
|
public readonly Type: number;
|
|
110
|
-
public readonly Speed: number;
|
|
110
|
+
public readonly Speed: number | null = null;
|
|
111
111
|
public readonly Easing: string;
|
|
112
112
|
public readonly BoundaryProtect: number;
|
|
113
|
+
public readonly Duration: number | null = null;
|
|
113
114
|
|
|
114
|
-
protected constructor(type: number, speed: number, easing: string, boundaryProtect: number) {
|
|
115
|
+
protected constructor(type: number, speed: number, duration: number | null, easing: string, boundaryProtect: number) {
|
|
116
|
+
if (typeof speed != "number" || speed <= 0) {
|
|
117
|
+
console.error("SlideSetting error: speed must be number greater than 0.");
|
|
118
|
+
speed = defaultSpeed;
|
|
119
|
+
}
|
|
115
120
|
this.Type = type;
|
|
116
121
|
this.Speed = speed;
|
|
117
122
|
this.Easing = easing;
|
|
123
|
+
this.Duration = duration;
|
|
118
124
|
this.BoundaryProtect = boundaryProtect;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
@@ -136,8 +142,9 @@ export class WholePageSlide extends SlideSetting {
|
|
|
136
142
|
speed = defaultSpeed,
|
|
137
143
|
easing = defaultEasing,
|
|
138
144
|
boundaryProtect = SlideSetting.START_PROTECT,
|
|
145
|
+
duration = null,
|
|
139
146
|
} = {}) {
|
|
140
|
-
super(SlideSetting.Type.WHOLE_PAGE, speed, easing, boundaryProtect);
|
|
147
|
+
super(SlideSetting.Type.WHOLE_PAGE, speed, duration, easing, boundaryProtect);
|
|
141
148
|
}
|
|
142
149
|
}
|
|
143
150
|
|
|
@@ -153,22 +160,27 @@ export class WholePageSlide extends SlideSetting {
|
|
|
153
160
|
* speed: 滚动速度, 像素/毫秒
|
|
154
161
|
* easing: 滚动动画的easing
|
|
155
162
|
* boundaryProtect: 确定滚动位置能否小于0或者大于最大长度
|
|
163
|
+
* fixFirstPage: 首页不滚动
|
|
156
164
|
* }
|
|
157
165
|
**/
|
|
158
166
|
export class SeamlessSlide extends SlideSetting {
|
|
159
167
|
public readonly StartPercent: number;
|
|
160
168
|
public readonly EndPercent: number;
|
|
169
|
+
public readonly FixFirstPage: boolean;
|
|
161
170
|
|
|
162
171
|
constructor({
|
|
163
172
|
startPercent = 0.2,
|
|
164
173
|
endPercent = 0.8,
|
|
165
174
|
speed = defaultSpeed,
|
|
175
|
+
duration = null,
|
|
166
176
|
easing = defaultEasing,
|
|
177
|
+
fixFirstPage = false,
|
|
167
178
|
boundaryProtect = SlideSetting.START_PROTECT | SlideSetting.END_PROTECT,
|
|
168
179
|
} = {}) {
|
|
169
|
-
super(SlideSetting.Type.SEAMLESS, speed, easing, boundaryProtect);
|
|
180
|
+
super(SlideSetting.Type.SEAMLESS, speed, duration, easing, boundaryProtect);
|
|
170
181
|
this.StartPercent = startPercent;
|
|
171
182
|
this.EndPercent = endPercent;
|
|
183
|
+
this.FixFirstPage = fixFirstPage;
|
|
172
184
|
}
|
|
173
185
|
}
|
|
174
186
|
|
|
@@ -183,19 +195,24 @@ export class SeamlessSlide extends SlideSetting {
|
|
|
183
195
|
* speed: 滚动速度, 像素/毫秒
|
|
184
196
|
* easing: 滚动动画的easing
|
|
185
197
|
* boundaryProtect: 确定滚动位置能否小于0或者大于最大长度
|
|
198
|
+
* fixFirstPage: 首页不滚动
|
|
186
199
|
* }
|
|
187
200
|
**/
|
|
188
201
|
export class FixPositionSlide extends SlideSetting {
|
|
189
202
|
public readonly FixPercent: number;
|
|
203
|
+
public readonly FixFirstPage: boolean;
|
|
190
204
|
|
|
191
205
|
constructor({
|
|
192
206
|
fixPercent = .5,
|
|
193
207
|
speed = defaultSpeed,
|
|
208
|
+
duration = null,
|
|
194
209
|
easing = defaultEasing,
|
|
210
|
+
fixFirstPage = false,
|
|
195
211
|
boundaryProtect = SlideSetting.START_PROTECT | SlideSetting.END_PROTECT,
|
|
196
212
|
} = {}) {
|
|
197
|
-
super(SlideSetting.Type.FIX_POSITION, speed, easing, boundaryProtect);
|
|
213
|
+
super(SlideSetting.Type.FIX_POSITION, speed, duration, easing, boundaryProtect);
|
|
198
214
|
this.FixPercent = fixPercent;
|
|
215
|
+
this.FixFirstPage = fixFirstPage;
|
|
199
216
|
}
|
|
200
217
|
}
|
|
201
218
|
|
|
@@ -205,4 +222,6 @@ export const FocusMoveType = {
|
|
|
205
222
|
ROW_LOOP: 0x00000001 << 1,
|
|
206
223
|
COLUMN_FIND_NEAR: 0x00000001 << 2,
|
|
207
224
|
ROW_FIND_NEAR: 0x00000001 << 3,
|
|
208
|
-
};
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const RENDER_ITEM_BREAK_KEY = "__QcodeJsviewMetroWidgetSlot";
|
|
@@ -10,7 +10,7 @@ let globalLoadJsvAudioPlugin;
|
|
|
10
10
|
let _JsvAudio;
|
|
11
11
|
|
|
12
12
|
if (!window.JsView) {
|
|
13
|
-
const BrowserJsvAudio = await import("./
|
|
13
|
+
const BrowserJsvAudio = await import("./BrowserAudio/BrowserAudio.vue");
|
|
14
14
|
//browser
|
|
15
15
|
globalLoadJsvAudioPlugin = (listener) => {
|
|
16
16
|
setTimeout(listener, 0);
|