@shijiu/jsview-vue 0.9.359-alpha.0 → 0.9.422
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/target_core_revision.js +3 -3
- package/loader/jsview.config.default.js +1 -1
- package/loader/jsview.default.config.js +1 -1
- package/loader/loader.js +2 -1
- package/package.json +1 -1
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +1 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +20 -7
- package/samples/Basic/App.vue +37 -29
- package/samples/Basic/components/ContentBlock.vue +1 -1
- package/samples/Basic/components/FontStyle.css +6 -0
- package/samples/Basic/components/div/DivBackground.vue +1 -1
- package/samples/Basic/components/div/DivCssScoped.vue +6 -13
- package/samples/Basic/components/div/DivCssVar.vue +3 -7
- package/samples/Basic/components/div/DivGroup2.vue +7 -2
- package/samples/Basic/components/div/DivLayout.vue +3 -3
- package/samples/Basic/components/div/DivTransform.vue +27 -0
- package/samples/Basic/components/img/ImageGroup.vue +31 -0
- package/samples/Basic/components/img/ImgLayout.vue +41 -0
- package/samples/Basic/components/panel/Panel1.vue +53 -0
- package/samples/Basic/components/panel/Panel2.vue +35 -0
- package/samples/Basic/components/panel/TitleBar.vue +29 -0
- package/samples/Basic/components/text/TextEmoji.vue +30 -0
- package/samples/Basic/components/text/{TextGroup.vue → TextGroup1.vue} +0 -0
- package/samples/Basic/components/text/TextGroup2.vue +31 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +13 -0
- package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +63 -0
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.js +19 -0
- package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +51 -0
- package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +220 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1860 -0
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +153 -0
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +137 -118
- package/utils/JsViewEngineWidget/TemplateParser.js +212 -158
- package/utils/JsViewEngineWidget/index.js +3 -2
- package/utils/JsViewPlugin/BrowserPluginLoader.js +14 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +502 -108
- package/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.js +101 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +262 -92
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +40 -0
- package/utils/JsViewPlugin/JsvPlayer/index.js +27 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +1 -2
- package/utils/JsViewVueWidget/JsvMarquee.vue +18 -10
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -3
- package/utils/JsViewVueWidget/JsvNinePatch.vue +28 -10
- package/samples/Basic/components/TitleBar.vue +0 -27
|
@@ -1,48 +1,107 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
import { RangesModel, SingleRangeModel } from "./RangeModel";
|
|
2
3
|
import { RectArea } from "./RectUtils";
|
|
3
4
|
import { VERTICAL, HORIZONTAL } from "./WidgetCommon";
|
|
5
|
+
const TAG = "TemplateParser: ";
|
|
4
6
|
|
|
5
|
-
function
|
|
7
|
+
function integerCheck(value, warn_func) {
|
|
8
|
+
const result = Math.round(value);
|
|
9
|
+
if (result !== value) {
|
|
10
|
+
warn_func();
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const measureObjectCheckMap = {
|
|
16
|
+
left: (obj) => {
|
|
17
|
+
if (isNaN(obj.left)) {
|
|
18
|
+
return 0;
|
|
19
|
+
} else {
|
|
20
|
+
return integerCheck(obj.left, () => {
|
|
21
|
+
console.warn(TAG, "left is not integer", obj);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
top: (obj) => {
|
|
26
|
+
if (isNaN(obj.top)) {
|
|
27
|
+
return 0;
|
|
28
|
+
} else {
|
|
29
|
+
return integerCheck(obj.top, () => {
|
|
30
|
+
console.warn(TAG, "top is not integer", obj);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
width: (obj) => {
|
|
35
|
+
if (isNaN(obj.width)) {
|
|
36
|
+
if (isNaN(obj.block?.w)) {
|
|
37
|
+
console.warn(TAG, "key 'block' is deprecated ");
|
|
38
|
+
return integerCheck(obj.blocks.w, () => {
|
|
39
|
+
console.warn(TAG, "width is not integer", obj);
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
throw new Error(TAG + "width is not definied");
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
return integerCheck(obj.width, () => {
|
|
46
|
+
console.warn(TAG, "width is not integer", obj);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
height: (obj) => {
|
|
51
|
+
if (isNaN(obj.height)) {
|
|
52
|
+
if (isNaN(obj.block?.h)) {
|
|
53
|
+
console.warn(TAG, "key 'block' is deprecated ");
|
|
54
|
+
return integerCheck(obj.blocks.h, () => {
|
|
55
|
+
console.warn(TAG, "height is not integer", obj);
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
throw new Error(TAG + "height is not definied");
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return integerCheck(obj.height, () => {
|
|
62
|
+
console.warn(TAG, "height is not integer", obj);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
function measureObjectChecker(obj) {
|
|
68
|
+
for (let key in measureObjectCheckMap) {
|
|
69
|
+
obj[key] = measureObjectCheckMap[key](obj);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getTemplateItem(measure_obj, data_info) {
|
|
74
|
+
measureObjectChecker(measure_obj);
|
|
6
75
|
return {
|
|
7
76
|
id: -1,
|
|
8
77
|
index: -1,
|
|
9
|
-
xPos:
|
|
10
|
-
yPos:
|
|
78
|
+
xPos: measure_obj.left, // Set after template be layout
|
|
79
|
+
yPos: measure_obj.top, // Set after template be layout
|
|
11
80
|
centerXPos: 0, // Set after template be layout
|
|
12
81
|
centerYPos: 0, // Set after template be layout
|
|
13
|
-
width:
|
|
14
|
-
|
|
15
|
-
? layout_info.width
|
|
16
|
-
: layout_info.blocks.w,
|
|
17
|
-
height:
|
|
18
|
-
typeof layout_info.height !== "undefined"
|
|
19
|
-
? layout_info.height
|
|
20
|
-
: layout_info.blocks.h,
|
|
82
|
+
width: measure_obj.width,
|
|
83
|
+
height: measure_obj.height,
|
|
21
84
|
focusable:
|
|
22
|
-
typeof
|
|
85
|
+
typeof measure_obj.focusable === "undefined"
|
|
23
86
|
? true
|
|
24
|
-
:
|
|
87
|
+
: measure_obj.focusable,
|
|
25
88
|
data: data_info,
|
|
26
89
|
marginRight:
|
|
27
|
-
typeof
|
|
28
|
-
?
|
|
90
|
+
typeof measure_obj.marginRight !== "undefined"
|
|
91
|
+
? measure_obj.marginRight
|
|
29
92
|
: 0,
|
|
30
93
|
marginBottom:
|
|
31
|
-
typeof
|
|
32
|
-
?
|
|
94
|
+
typeof measure_obj.marginBottom !== "undefined"
|
|
95
|
+
? measure_obj.marginBottom
|
|
33
96
|
: 0,
|
|
34
97
|
findNextAnchor:
|
|
35
|
-
typeof
|
|
36
|
-
?
|
|
98
|
+
typeof measure_obj.findNextAnchor !== "undefined"
|
|
99
|
+
? measure_obj.findNextAnchor
|
|
37
100
|
: null,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// : layout_info.needRedraw,
|
|
43
|
-
// onBottomLine: false, // is bottom line of horizontal mode metro(which can draw with reflection effect)
|
|
44
|
-
// view: null,
|
|
45
|
-
// mounted: false,
|
|
101
|
+
doSlide:
|
|
102
|
+
typeof measure_obj.doSlide !== "undefined" ? measure_obj.doSlide : true,
|
|
103
|
+
pageNumber: -1,
|
|
104
|
+
pageHeadIndex: -1,
|
|
46
105
|
};
|
|
47
106
|
}
|
|
48
107
|
|
|
@@ -237,21 +296,14 @@ class Fence {
|
|
|
237
296
|
}
|
|
238
297
|
|
|
239
298
|
class TemplateParser {
|
|
240
|
-
constructor(
|
|
241
|
-
direction,
|
|
242
|
-
lineMax,
|
|
243
|
-
layoutType,
|
|
244
|
-
visibleWidth,
|
|
245
|
-
visibleHeight,
|
|
246
|
-
supportHistoryPath
|
|
247
|
-
) {
|
|
299
|
+
constructor(direction, lineMax, pageSize, layoutType, supportHistoryPath) {
|
|
248
300
|
this._Template = new MetroTemplate(direction, lineMax, layoutType);
|
|
249
301
|
this._FenceStack = [new Fence(0, 0, this._Template.Orient.widthMax, 0)];
|
|
250
302
|
this._Identity = 0;
|
|
251
|
-
this._MoveLimitArea = new RectArea(0, 0, visibleWidth, visibleHeight);
|
|
252
303
|
this._FenceEdge = { StartX: 0, StartY: 0 }; // 新的未占用边列表生成
|
|
253
304
|
this._NotOccupiedEdgeList = []; // 未占用边列表
|
|
254
305
|
this._SupportHistoryPath = supportHistoryPath;
|
|
306
|
+
this._PageSize = pageSize;
|
|
255
307
|
// this._VisibleRangeSearchBaseItem = null;
|
|
256
308
|
}
|
|
257
309
|
|
|
@@ -538,7 +590,7 @@ class TemplateParser {
|
|
|
538
590
|
},
|
|
539
591
|
};
|
|
540
592
|
let cross_neighbor_key = key_map.cross[direction];
|
|
541
|
-
let target_neighbor_key =
|
|
593
|
+
let target_neighbor_key = key_map.target[direction];
|
|
542
594
|
if (!cross_neighbor_key || !target_neighbor_key) {
|
|
543
595
|
console.error("_TryUpdateItemNeighbor: undefined direction", direction);
|
|
544
596
|
}
|
|
@@ -764,9 +816,6 @@ class TemplateParser {
|
|
|
764
816
|
const template_item = getTemplateItem(item_obj, data_obj);
|
|
765
817
|
// Layout template items
|
|
766
818
|
const fence_stack = this._FenceStack;
|
|
767
|
-
let cur_page_head_id = -1; // 获取当前页的头ID,MetroWidget默认焦点时用
|
|
768
|
-
let cur_page_index = 1;
|
|
769
|
-
|
|
770
819
|
const item_id = template_item.id;
|
|
771
820
|
const item_width = template_item.width;
|
|
772
821
|
const item_height = template_item.height;
|
|
@@ -777,11 +826,9 @@ class TemplateParser {
|
|
|
777
826
|
let y_width;
|
|
778
827
|
let item_key_pos = 0;
|
|
779
828
|
let item_second_pos = 0;
|
|
780
|
-
let tmp_index = 0;
|
|
781
829
|
|
|
782
830
|
let item_key_width = 0;
|
|
783
831
|
let item_second_width = 0;
|
|
784
|
-
|
|
785
832
|
let item_key_margin = 0;
|
|
786
833
|
let item_second_margin = 0;
|
|
787
834
|
if (this._Template.Layout.type === "relative") {
|
|
@@ -814,8 +861,7 @@ class TemplateParser {
|
|
|
814
861
|
item_key_pos = gap_info.startPos;
|
|
815
862
|
item_second_pos = top_fence.AheadOffset;
|
|
816
863
|
} else {
|
|
817
|
-
|
|
818
|
-
console.log("ERROR: coding error, header full gap fence lost");
|
|
864
|
+
console.error(TAG, "ERROR: coding error, header full gap fence lost");
|
|
819
865
|
}
|
|
820
866
|
|
|
821
867
|
if (this._Template.Orient.type === VERTICAL) {
|
|
@@ -823,35 +869,19 @@ class TemplateParser {
|
|
|
823
869
|
y_pos = item_second_pos;
|
|
824
870
|
x_width = item_key_width;
|
|
825
871
|
y_width = item_second_width;
|
|
826
|
-
tmp_index = (y_pos + y_width) / this._MoveLimitArea.height;
|
|
827
872
|
} else {
|
|
828
873
|
x_pos = item_second_pos;
|
|
829
874
|
y_pos = item_key_pos;
|
|
830
875
|
x_width = item_second_width;
|
|
831
876
|
y_width = item_key_width;
|
|
832
|
-
tmp_index = (x_pos + x_width) / this._MoveLimitArea.width;
|
|
833
877
|
}
|
|
834
878
|
} else {
|
|
835
879
|
x_pos = template_item.xPos;
|
|
836
880
|
y_pos = template_item.yPos;
|
|
837
881
|
x_width = item_width;
|
|
838
882
|
y_width = item_height;
|
|
839
|
-
if (this._Template.Orient.type === VERTICAL) {
|
|
840
|
-
tmp_index = (y_pos + y_width) / this._MoveLimitArea.height;
|
|
841
|
-
} else {
|
|
842
|
-
tmp_index = (x_pos + x_width) / this._MoveLimitArea.width;
|
|
843
|
-
}
|
|
844
883
|
}
|
|
845
884
|
|
|
846
|
-
if (cur_page_head_id === -1) {
|
|
847
|
-
cur_page_head_id = item_id;
|
|
848
|
-
}
|
|
849
|
-
const tmp_page_index = Math.ceil(tmp_index);
|
|
850
|
-
if (tmp_index >= 0 && tmp_page_index !== cur_page_index) {
|
|
851
|
-
cur_page_index = tmp_page_index;
|
|
852
|
-
cur_page_head_id = item_id;
|
|
853
|
-
}
|
|
854
|
-
template_item.curPageHeadId = cur_page_head_id;
|
|
855
885
|
// Update template item information
|
|
856
886
|
template_item.neighborIndexList = {
|
|
857
887
|
left: [],
|
|
@@ -876,6 +906,33 @@ class TemplateParser {
|
|
|
876
906
|
template_item.yPos = y_pos;
|
|
877
907
|
template_item.centerXPos = Math.floor(x_pos + x_width / 2) - 1;
|
|
878
908
|
template_item.centerYPos = Math.floor(y_pos + y_width / 2) - 1;
|
|
909
|
+
//分页相关的计算
|
|
910
|
+
let cur_page_number = 0;
|
|
911
|
+
let cur_page_head_index = 0;
|
|
912
|
+
if (this._Template.List.length > 0) {
|
|
913
|
+
const last_item = this._Template.List[this._Template.List.length - 1];
|
|
914
|
+
cur_page_number = last_item.pageNumber;
|
|
915
|
+
cur_page_head_index = last_item.pageHeadIndex;
|
|
916
|
+
let position_key = "xPos";
|
|
917
|
+
let size_key = "width";
|
|
918
|
+
if (this._Template.Orient.type === VERTICAL) {
|
|
919
|
+
position_key = "yPos";
|
|
920
|
+
size_key = "height";
|
|
921
|
+
}
|
|
922
|
+
const cur_page_start =
|
|
923
|
+
this._Template.List[cur_page_head_index][position_key];
|
|
924
|
+
if (
|
|
925
|
+
template_item[position_key] + template_item[size_key] >
|
|
926
|
+
cur_page_start + this._PageSize
|
|
927
|
+
) {
|
|
928
|
+
//新的页
|
|
929
|
+
cur_page_number++;
|
|
930
|
+
cur_page_head_index = this._Template.List.length;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
template_item.pageNumber = cur_page_number;
|
|
935
|
+
template_item.pageHeadIndex = cur_page_head_index;
|
|
879
936
|
// if (
|
|
880
937
|
// this._Template.Orient.type !== VERTICAL &&
|
|
881
938
|
// y_pos + y_width === this._Template.Orient.widthMax
|
|
@@ -955,6 +1012,7 @@ class TemplateParser {
|
|
|
955
1012
|
fence_stack.splice(one_ahead_last_fence_idx + 1, 0, fence);
|
|
956
1013
|
}
|
|
957
1014
|
}
|
|
1015
|
+
return template_item;
|
|
958
1016
|
}
|
|
959
1017
|
|
|
960
1018
|
GetItemById(id) {
|
|
@@ -1062,6 +1120,23 @@ class TemplateParser {
|
|
|
1062
1120
|
return valid_id;
|
|
1063
1121
|
}
|
|
1064
1122
|
|
|
1123
|
+
_FindFocusableNeighbor(direction, item) {
|
|
1124
|
+
if (
|
|
1125
|
+
item.neighborIndexList[direction].length > 0 &&
|
|
1126
|
+
!this._CheckIdsHasFocusable(item.neighborIndexList[direction])
|
|
1127
|
+
) {
|
|
1128
|
+
const last_item_id =
|
|
1129
|
+
item.neighborIndexList[direction][
|
|
1130
|
+
item.neighborIndexList[direction].length - 1
|
|
1131
|
+
];
|
|
1132
|
+
const idx = this._GetValidNeighborIndex(item.id, last_item_id, direction); // 查找其左右邻居
|
|
1133
|
+
if (idx !== -1) {
|
|
1134
|
+
item.neighborIndexList[direction] = []; // 清除无效项
|
|
1135
|
+
item.neighborIndexList[direction].push(idx);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1065
1140
|
CalculateNeighborWhenAddStop() {
|
|
1066
1141
|
// Update Last Fence Edge(更新最后一行的fence edge)
|
|
1067
1142
|
this._UpdateLastFenceEdge();
|
|
@@ -1080,99 +1155,74 @@ class TemplateParser {
|
|
|
1080
1155
|
break;
|
|
1081
1156
|
}
|
|
1082
1157
|
}
|
|
1158
|
+
//处理找到的neighbor均是占位符的情况
|
|
1083
1159
|
for (let j = template_list.length - 1; j >= 0; j--) {
|
|
1084
1160
|
const item = template_list[j];
|
|
1085
1161
|
if (item.focusable) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
)
|
|
1090
|
-
const last_bottom_item_id =
|
|
1091
|
-
item.neighborIndexList.bottom[
|
|
1092
|
-
item.neighborIndexList.bottom.length - 1
|
|
1093
|
-
];
|
|
1094
|
-
const bottom_idx = this._GetValidNeighborIndex(
|
|
1095
|
-
j,
|
|
1096
|
-
last_bottom_item_id,
|
|
1097
|
-
"bottom"
|
|
1098
|
-
); // 查找其左右邻居
|
|
1099
|
-
if (bottom_idx !== -1) {
|
|
1100
|
-
item.neighborIndexList.bottom = []; // 清除无效项
|
|
1101
|
-
item.neighborIndexList.bottom.push(bottom_idx);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
if (
|
|
1105
|
-
item.neighborIndexList.top.length > 0 &&
|
|
1106
|
-
!this._CheckIdsHasFocusable(item.neighborIndexList.top)
|
|
1107
|
-
) {
|
|
1108
|
-
const top_idx = this._GetValidNeighborIndex(
|
|
1109
|
-
j,
|
|
1110
|
-
item.neighborIndexList.top[item.neighborIndexList.top.length - 1],
|
|
1111
|
-
"top"
|
|
1112
|
-
);
|
|
1113
|
-
if (top_idx !== -1) {
|
|
1114
|
-
item.neighborIndexList.top = []; // 清除无效项
|
|
1115
|
-
item.neighborIndexList.top.push(top_idx);
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
if (this._Template.Orient.type !== VERTICAL) {
|
|
1121
|
-
// 从后向前找(最后一项不用检查)
|
|
1122
|
-
// 如果向下未找到对象,则查找最后一行的最后一项
|
|
1123
|
-
let last_down_idx = null;
|
|
1124
|
-
let min_distance = -1;
|
|
1125
|
-
let distance = 0;
|
|
1126
|
-
// 向下操作 只检查最后一项
|
|
1127
|
-
for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1128
|
-
const pre_col_item = template_list[k];
|
|
1129
|
-
if (pre_col_item.focusable) {
|
|
1130
|
-
if (pre_col_item.yPos >= last_item.yPos + last_item.height) {
|
|
1131
|
-
if (
|
|
1132
|
-
pre_col_item.neighborIndexList.right.length === 0 ||
|
|
1133
|
-
!this._CheckIdsHasFocusable(
|
|
1134
|
-
pre_col_item.neighborIndexList.right
|
|
1135
|
-
) ||
|
|
1136
|
-
this._IsInNeighborList(
|
|
1137
|
-
pre_col_item.neighborIndexList.right,
|
|
1138
|
-
last_item_index
|
|
1139
|
-
)
|
|
1140
|
-
) {
|
|
1141
|
-
// 有邻居中有last_item_index
|
|
1142
|
-
distance =
|
|
1143
|
-
(last_item.xPos - pre_col_item.xPos) ** 2 +
|
|
1144
|
-
(last_item.yPos - pre_col_item.yPos) ** 2;
|
|
1145
|
-
if (min_distance === -1) {
|
|
1146
|
-
min_distance = distance;
|
|
1147
|
-
last_down_idx = k;
|
|
1148
|
-
} else if (min_distance > distance) {
|
|
1149
|
-
min_distance = distance;
|
|
1150
|
-
last_down_idx = k;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
if (last_down_idx) {
|
|
1157
|
-
last_item.neighborIndexList.bottom = []; // 清除无效项
|
|
1158
|
-
last_item.neighborIndexList.bottom.push(last_down_idx);
|
|
1159
|
-
}
|
|
1160
|
-
} else {
|
|
1161
|
-
// vertical
|
|
1162
|
-
for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1163
|
-
const pre_row_item = template_list[k];
|
|
1164
|
-
if (pre_row_item.focusable) {
|
|
1165
|
-
if (
|
|
1166
|
-
pre_row_item.yPos + pre_row_item.height <
|
|
1167
|
-
last_item.yPos + last_item.height
|
|
1168
|
-
) {
|
|
1169
|
-
if (pre_row_item.neighborIndexList.bottom.length === 0) {
|
|
1170
|
-
pre_row_item.neighborIndexList.bottom.push(last_item_index);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1162
|
+
this._FindFocusableNeighbor("bottom", item);
|
|
1163
|
+
this._FindFocusableNeighbor("top", item);
|
|
1164
|
+
this._FindFocusableNeighbor("left", item);
|
|
1165
|
+
this._FindFocusableNeighbor("right", item);
|
|
1174
1166
|
}
|
|
1175
1167
|
}
|
|
1168
|
+
// if (this._Template.Orient.type !== VERTICAL) {
|
|
1169
|
+
// // 从后向前找(最后一项不用检查)
|
|
1170
|
+
// // 如果向下未找到对象,则查找最后一行的最后一项
|
|
1171
|
+
// let last_down_idx = null;
|
|
1172
|
+
// let min_distance = -1;
|
|
1173
|
+
// let distance = 0;
|
|
1174
|
+
// // 向下操作 只检查最后一项
|
|
1175
|
+
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1176
|
+
// const pre_col_item = template_list[k];
|
|
1177
|
+
// if (pre_col_item.focusable) {
|
|
1178
|
+
// if (pre_col_item.yPos >= last_item.yPos + last_item.height) {
|
|
1179
|
+
// if (
|
|
1180
|
+
// pre_col_item.neighborIndexList.right.length === 0 ||
|
|
1181
|
+
// !this._CheckIdsHasFocusable(
|
|
1182
|
+
// pre_col_item.neighborIndexList.right
|
|
1183
|
+
// ) ||
|
|
1184
|
+
// this._IsInNeighborList(
|
|
1185
|
+
// pre_col_item.neighborIndexList.right,
|
|
1186
|
+
// last_item_index
|
|
1187
|
+
// )
|
|
1188
|
+
// ) {
|
|
1189
|
+
// // 有邻居中有last_item_index
|
|
1190
|
+
// distance =
|
|
1191
|
+
// (last_item.xPos - pre_col_item.xPos) ** 2 +
|
|
1192
|
+
// (last_item.yPos - pre_col_item.yPos) ** 2;
|
|
1193
|
+
// if (min_distance === -1) {
|
|
1194
|
+
// min_distance = distance;
|
|
1195
|
+
// last_down_idx = k;
|
|
1196
|
+
// } else if (min_distance > distance) {
|
|
1197
|
+
// min_distance = distance;
|
|
1198
|
+
// last_down_idx = k;
|
|
1199
|
+
// }
|
|
1200
|
+
// }
|
|
1201
|
+
// }
|
|
1202
|
+
// }
|
|
1203
|
+
// }
|
|
1204
|
+
// if (last_down_idx) {
|
|
1205
|
+
// last_item.neighborIndexList.bottom = []; // 清除无效项
|
|
1206
|
+
// console.log('cchtest bottom add 2', last_down_idx)
|
|
1207
|
+
// last_item.neighborIndexList.bottom.push(last_down_idx);
|
|
1208
|
+
// }
|
|
1209
|
+
// } else {
|
|
1210
|
+
// // vertical
|
|
1211
|
+
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1212
|
+
// const pre_row_item = template_list[k];
|
|
1213
|
+
// if (pre_row_item.focusable) {
|
|
1214
|
+
// if (
|
|
1215
|
+
// pre_row_item.yPos + pre_row_item.height <
|
|
1216
|
+
// last_item.yPos + last_item.height
|
|
1217
|
+
// ) {
|
|
1218
|
+
// if (pre_row_item.neighborIndexList.bottom.length === 0) {
|
|
1219
|
+
// console.log('cchtest bottom add 3', last_item_index)
|
|
1220
|
+
// pre_row_item.neighborIndexList.bottom.push(last_item_index);
|
|
1221
|
+
// }
|
|
1222
|
+
// }
|
|
1223
|
+
// }
|
|
1224
|
+
// }
|
|
1225
|
+
// }
|
|
1176
1226
|
}
|
|
1177
1227
|
|
|
1178
1228
|
/**
|
|
@@ -1628,10 +1678,14 @@ class TemplateParser {
|
|
|
1628
1678
|
const key_width = be_vertical_template
|
|
1629
1679
|
? check_item.width + check_item.marginRight
|
|
1630
1680
|
: check_item.height + check_item.marginBottom;
|
|
1681
|
+
const key_start = Math.round(key_pos);
|
|
1682
|
+
const key_end = Math.round(key_pos + key_width - 1);
|
|
1631
1683
|
const second_pos = be_vertical_template ? check_item.yPos : check_item.xPos;
|
|
1632
1684
|
const second_width = be_vertical_template
|
|
1633
1685
|
? check_item.height + check_item.marginBottom
|
|
1634
1686
|
: check_item.width + check_item.marginRight;
|
|
1687
|
+
const second_start = Math.round(second_pos);
|
|
1688
|
+
const second_end = Math.round(second_pos + second_width - 1);
|
|
1635
1689
|
// console.log(
|
|
1636
1690
|
// "idx=" +
|
|
1637
1691
|
// (configures.baseIdx + offset) +
|
|
@@ -1649,24 +1703,24 @@ class TemplateParser {
|
|
|
1649
1703
|
) {
|
|
1650
1704
|
let is_range_changed = false;
|
|
1651
1705
|
if (
|
|
1652
|
-
|
|
1653
|
-
|
|
1706
|
+
second_start <= configures.common.checkingStartLinePos &&
|
|
1707
|
+
second_end >= configures.common.checkingStartLinePos
|
|
1654
1708
|
) {
|
|
1655
1709
|
// Overlap the visbible start line
|
|
1656
1710
|
configures.latestOverStartLineIdx = configures.baseIdx + offset;
|
|
1657
1711
|
if (configures.firstStartLineBlockIdx < 0)
|
|
1658
1712
|
configures.firstStartLineBlockIdx = configures.baseIdx + offset;
|
|
1659
1713
|
configures.checkingStartLineRanges.Merge(
|
|
1660
|
-
new SingleRangeModel(
|
|
1714
|
+
new SingleRangeModel(key_start, key_end)
|
|
1661
1715
|
);
|
|
1662
1716
|
is_range_changed = true;
|
|
1663
1717
|
} else if (
|
|
1664
1718
|
configures.searchDirect < 0 &&
|
|
1665
|
-
|
|
1719
|
+
second_end <= configures.common.checkingStartLinePos
|
|
1666
1720
|
) {
|
|
1667
1721
|
// above the visible start line
|
|
1668
1722
|
configures.checkingStartLineRanges.Merge(
|
|
1669
|
-
new SingleRangeModel(
|
|
1723
|
+
new SingleRangeModel(key_start, key_end)
|
|
1670
1724
|
);
|
|
1671
1725
|
is_range_changed = true;
|
|
1672
1726
|
}
|
|
@@ -1716,24 +1770,24 @@ class TemplateParser {
|
|
|
1716
1770
|
if (configures.common.resultEndIdx < 0 && !configures.endLineRangesFulled) {
|
|
1717
1771
|
let is_range_changed = false;
|
|
1718
1772
|
if (
|
|
1719
|
-
|
|
1720
|
-
|
|
1773
|
+
second_start <= configures.common.checkingEndLinePos &&
|
|
1774
|
+
second_end >= configures.common.checkingEndLinePos
|
|
1721
1775
|
) {
|
|
1722
1776
|
// Overlap the visbible end line
|
|
1723
1777
|
configures.latestOverEndLineIdx = configures.baseIdx + offset;
|
|
1724
1778
|
if (configures.firstEndLineBlockIdx < 0)
|
|
1725
1779
|
configures.firstEndLineBlockIdx = configures.baseIdx + offset;
|
|
1726
1780
|
configures.checkingEndLineRanges.Merge(
|
|
1727
|
-
new SingleRangeModel(
|
|
1781
|
+
new SingleRangeModel(key_start, key_end)
|
|
1728
1782
|
);
|
|
1729
1783
|
is_range_changed = true;
|
|
1730
1784
|
} else if (
|
|
1731
1785
|
configures.searchDirect > 0 &&
|
|
1732
|
-
|
|
1786
|
+
second_start >= configures.common.checkingEndLinePos
|
|
1733
1787
|
) {
|
|
1734
1788
|
// below the visible end line
|
|
1735
1789
|
configures.checkingEndLineRanges.Merge(
|
|
1736
|
-
new SingleRangeModel(
|
|
1790
|
+
new SingleRangeModel(key_start, key_end)
|
|
1737
1791
|
);
|
|
1738
1792
|
is_range_changed = true;
|
|
1739
1793
|
}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-06-16 10:07:20
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2022-03-08 15:52:24
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export * from "./WidgetCommon";
|
|
10
10
|
export * from "./SimpleWidget/Dispatcher";
|
|
11
11
|
|
|
12
|
-
export { default as SimpleWidget } from "./
|
|
12
|
+
export { default as SimpleWidget } from "./MetroWidget/MetroWidget.vue";
|
|
13
13
|
export { default as JsvFocusBlock } from "./JsvFocusBlock.vue";
|
|
14
|
+
export { default as MetroWidget } from "./MetroWidget/MetroWidget.vue";
|
|
14
15
|
export { jsvCreateFocusManager } from "./JsvFocusManager";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: LuDonglin
|
|
3
|
+
* @Date: 2022-2-24 14:00:00
|
|
4
|
+
* @LastEditors: LuDonglin
|
|
5
|
+
* @LastEditTime: 2022-2-24 14:00:00
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { JsvWidgetWrapperGroup } from 'jsview/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js';
|
|
9
|
+
//考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
|
|
10
|
+
import * as BrowserJsvPlayer from "./JsvPlayer/JsvPlayerBrowser.vue";
|
|
11
|
+
|
|
12
|
+
JsvWidgetWrapperGroup.BrowserJsvPlayer = BrowserJsvPlayer;
|
|
13
|
+
|
|
14
|
+
console.log("load browser plugin widgets.");
|