@shijiu/jsview-vue 1.9.650 → 1.9.719
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 +7 -18
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/text/TextOverflow.vue +10 -5
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +452 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
- package/samples/DemoHomepage/router.js +21 -1
- package/samples/DemoHomepage/views/Homepage.vue +3 -7
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +2 -2
- package/samples/GridDemo/App.vue +3 -3
- package/samples/GridDemo/ButtonBlock.vue +2 -2
- package/samples/GridDemo/FocusItem.vue +2 -2
- package/samples/GridDemo/Item.vue +1 -1
- package/samples/HashHistory/App.vue +10 -3
- package/samples/HashHistory/components/Item.vue +1 -1
- package/samples/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -17
- package/samples/Input/InputPanel.vue +19 -12
- package/samples/LongImage/Button.vue +1 -1
- package/samples/LongImage/ButtonItem.vue +1 -1
- package/samples/LongImage/LongImageScroll.vue +2 -2
- package/samples/LongText/App.vue +1 -1
- package/samples/LongText/Button.vue +1 -1
- package/samples/LongText/ButtonItem.vue +1 -1
- package/samples/LongText/LongTextScroll.vue +3 -3
- package/samples/Marquee/App.vue +176 -40
- package/samples/Marquee/longText.js +14 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +3 -3
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +20 -2
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
- package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +3 -11
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
- package/samples/MetroWidgetDemos/WidgetItem.vue +2 -2
- package/samples/MetroWidgetDemos/data.js +2 -1
- package/samples/NinePatchDemo/App.vue +2 -2
- package/samples/NinePatchDemo/Item.vue +1 -1
- package/samples/Preload/App.vue +17 -12
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/ScaleDownNeon/App.vue +107 -0
- package/samples/SoundPool/App.vue +1 -1
- package/samples/TextBox/App.vue +9 -82
- package/samples/TextBox/RenderCenter.vue +40 -16
- package/samples/TextBox/RenderLeft.vue +48 -19
- package/samples/TextBox/RenderOneLine.vue +30 -49
- package/samples/TextBox/RenderRight.vue +40 -16
- package/samples/TextShadowDemo/App.vue +11 -17
- package/samples/TextureAnimation/App2.vue +43 -15
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureSize/App.vue +3 -3
- package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TransitPage/App.vue +1 -1
- package/samples/VideoDemo/App.vue +8 -8
- package/samples/VideoDemo/components/Button.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +94 -27
- package/tsconfig.json +6 -6
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +55 -59
- package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +226 -107
- package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
- package/utils/JsViewEngineWidget/WidgetCommon.js +13 -5
- package/utils/JsViewEngineWidget/index.js +3 -2
- package/utils/JsViewPlugin/BrowserPluginLoader.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +23 -2
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +1 -1
- package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/JsvStyleClass.js +1 -1
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +7 -9
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +3 -3
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +5 -5
- package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
- package/utils/JsViewVueWidget/JsvGrid.vue +3 -11
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +5 -3
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +15 -14
- package/utils/JsViewVueWidget/JsvMarquee.vue +180 -207
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -2
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +38 -42
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +24 -8
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
- package/utils/JsViewVueWidget/JsvTextBox.vue +20 -86
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -9
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +6 -7
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +6 -6
- package/utils/JsViewVueWidget/index.js +8 -8
- package/utils/JsViewVueWidget/utils/index.js +8 -0
- package/utils/JsViewVueWidget/utils/text.js +19 -0
- package/dom/bin/jsview-browser-debug-dom.min.js +0 -1
- package/dom/bin/jsview-dom.min.js +0 -1
- package/dom/bin/jsview-forge-define.min.js +0 -1
- package/dom/browser-root-style.css +0 -21
- package/dom/jsv-browser-debug-dom.js +0 -8
- package/dom/jsv-dom.js +0 -6
- package/dom/jsv-forge-define.js +0 -6
- package/dom/target_core_revision.mjs +0 -15
- package/loader/header_script_loader.js +0 -134
- package/loader/jsview-main.js +0 -42
- package/loader/jsview.config.default.js +0 -37
- package/loader/jsview.default.config.js +0 -37
- package/loader/loader.js +0 -179
- package/loader/loader_webkit.js +0 -40
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17609
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -335
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +0 -446
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +0 -91
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8038
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1700
- package/patches/node_modules/postcss-js/objectifier.js +0 -90
- package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +0 -63147
- package/patches/node_modules/vite/dist/node/jsview.vite.config.js +0 -53
- package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3595
- package/scripts/common.js +0 -58
- package/scripts/jsview-install-local-packages.js +0 -73
- package/scripts/jsview-jsmap-serve.js +0 -105
- package/scripts/jsview-post-build.js +0 -183
- package/scripts/jsview-post-install.js +0 -102
- package/scripts/jsview-run-android.js +0 -67
- package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
- package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
- package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
- package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
- package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
- package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import { RangesModel, SingleRangeModel } from "./RangeModel";
|
|
3
3
|
import { RectArea } from "./RectUtils";
|
|
4
|
-
import { VERTICAL, HORIZONTAL } from "./WidgetCommon";
|
|
4
|
+
import { VERTICAL, HORIZONTAL, FocusMoveType } from "./WidgetCommon";
|
|
5
5
|
const TAG = "TemplateParser: ";
|
|
6
6
|
|
|
7
7
|
function integerCheck(value, warn_func) {
|
|
@@ -34,12 +34,12 @@ const measureObjectCheckMap = {
|
|
|
34
34
|
width: (obj) => {
|
|
35
35
|
if (isNaN(obj.width)) {
|
|
36
36
|
if (isNaN(obj.block?.w)) {
|
|
37
|
+
throw new Error(TAG + "width is not defined");
|
|
38
|
+
} else {
|
|
37
39
|
console.warn(TAG, "key 'block' is deprecated ");
|
|
38
40
|
return integerCheck(obj.blocks.w, () => {
|
|
39
41
|
console.warn(TAG, "width is not integer", obj);
|
|
40
42
|
});
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error(TAG + "width is not definied");
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
45
|
return integerCheck(obj.width, () => {
|
|
@@ -50,12 +50,12 @@ const measureObjectCheckMap = {
|
|
|
50
50
|
height: (obj) => {
|
|
51
51
|
if (isNaN(obj.height)) {
|
|
52
52
|
if (isNaN(obj.block?.h)) {
|
|
53
|
+
throw new Error(TAG + "height is not defined");
|
|
54
|
+
} else {
|
|
53
55
|
console.warn(TAG, "key 'block' is deprecated ");
|
|
54
56
|
return integerCheck(obj.blocks.h, () => {
|
|
55
57
|
console.warn(TAG, "height is not integer", obj);
|
|
56
58
|
});
|
|
57
|
-
} else {
|
|
58
|
-
throw new Error(TAG + "height is not definied");
|
|
59
59
|
}
|
|
60
60
|
} else {
|
|
61
61
|
return integerCheck(obj.height, () => {
|
|
@@ -72,6 +72,26 @@ function measureObjectChecker(obj) {
|
|
|
72
72
|
|
|
73
73
|
function getTemplateItem(measure_obj, data_info) {
|
|
74
74
|
measureObjectChecker(measure_obj);
|
|
75
|
+
|
|
76
|
+
let focusZIndex = -1,
|
|
77
|
+
normalZIndex = -1;
|
|
78
|
+
if (
|
|
79
|
+
typeof measure_obj["zIndex"] != "undefined" &&
|
|
80
|
+
measure_obj["zIndex"] != null
|
|
81
|
+
) {
|
|
82
|
+
if (typeof measure_obj["zIndex"] == "object") {
|
|
83
|
+
if (typeof measure_obj["zIndex"]["focus"] == "number") {
|
|
84
|
+
focusZIndex = measure_obj["zIndex"]["focus"];
|
|
85
|
+
}
|
|
86
|
+
if (typeof measure_obj["zIndex"]["normal"] == "number") {
|
|
87
|
+
normalZIndex = measure_obj["zIndex"]["normal"];
|
|
88
|
+
}
|
|
89
|
+
} else if (typeof measure_obj["zIndex"] == "number") {
|
|
90
|
+
focusZIndex = measure_obj["zIndex"];
|
|
91
|
+
normalZIndex = measure_obj["zIndex"];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
75
95
|
return {
|
|
76
96
|
id: -1,
|
|
77
97
|
index: -1,
|
|
@@ -106,6 +126,8 @@ function getTemplateItem(measure_obj, data_info) {
|
|
|
106
126
|
typeof measure_obj.permanent !== "undefined"
|
|
107
127
|
? measure_obj.permanent
|
|
108
128
|
: false,
|
|
129
|
+
focusZIndex,
|
|
130
|
+
normalZIndex,
|
|
109
131
|
};
|
|
110
132
|
}
|
|
111
133
|
|
|
@@ -867,7 +889,10 @@ class TemplateParser {
|
|
|
867
889
|
item_key_pos = gap_info.startPos;
|
|
868
890
|
item_second_pos = top_fence.AheadOffset;
|
|
869
891
|
} else {
|
|
870
|
-
|
|
892
|
+
throw new Error(
|
|
893
|
+
`${TAG} item size ${item_width}x${item_height} is greater than widget line max ${this._Template.Orient.widthMax}`
|
|
894
|
+
);
|
|
895
|
+
// console.error(TAG, "ERROR: coding error, header full gap fence lost");
|
|
871
896
|
}
|
|
872
897
|
|
|
873
898
|
if (this._Template.Orient.type === VERTICAL) {
|
|
@@ -1039,7 +1064,7 @@ class TemplateParser {
|
|
|
1039
1064
|
return this._Template.List.length;
|
|
1040
1065
|
}
|
|
1041
1066
|
|
|
1042
|
-
|
|
1067
|
+
IdToIndex(id) {
|
|
1043
1068
|
return this._Template.IdsMap[id];
|
|
1044
1069
|
}
|
|
1045
1070
|
|
|
@@ -1175,64 +1200,6 @@ class TemplateParser {
|
|
|
1175
1200
|
this._FindFocusableNeighbor("right", item);
|
|
1176
1201
|
}
|
|
1177
1202
|
}
|
|
1178
|
-
// if (this._Template.Orient.type !== VERTICAL) {
|
|
1179
|
-
// // 从后向前找(最后一项不用检查)
|
|
1180
|
-
// // 如果向下未找到对象,则查找最后一行的最后一项
|
|
1181
|
-
// let last_down_idx = null;
|
|
1182
|
-
// let min_distance = -1;
|
|
1183
|
-
// let distance = 0;
|
|
1184
|
-
// // 向下操作 只检查最后一项
|
|
1185
|
-
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1186
|
-
// const pre_col_item = template_list[k];
|
|
1187
|
-
// if (pre_col_item.focusable) {
|
|
1188
|
-
// if (pre_col_item.yPos >= last_item.yPos + last_item.height) {
|
|
1189
|
-
// if (
|
|
1190
|
-
// pre_col_item.neighborIndexList.right.length === 0 ||
|
|
1191
|
-
// !this._CheckIdsHasFocusable(
|
|
1192
|
-
// pre_col_item.neighborIndexList.right
|
|
1193
|
-
// ) ||
|
|
1194
|
-
// this._IsInNeighborList(
|
|
1195
|
-
// pre_col_item.neighborIndexList.right,
|
|
1196
|
-
// last_item_index
|
|
1197
|
-
// )
|
|
1198
|
-
// ) {
|
|
1199
|
-
// // 有邻居中有last_item_index
|
|
1200
|
-
// distance =
|
|
1201
|
-
// (last_item.xPos - pre_col_item.xPos) ** 2 +
|
|
1202
|
-
// (last_item.yPos - pre_col_item.yPos) ** 2;
|
|
1203
|
-
// if (min_distance === -1) {
|
|
1204
|
-
// min_distance = distance;
|
|
1205
|
-
// last_down_idx = k;
|
|
1206
|
-
// } else if (min_distance > distance) {
|
|
1207
|
-
// min_distance = distance;
|
|
1208
|
-
// last_down_idx = k;
|
|
1209
|
-
// }
|
|
1210
|
-
// }
|
|
1211
|
-
// }
|
|
1212
|
-
// }
|
|
1213
|
-
// }
|
|
1214
|
-
// if (last_down_idx) {
|
|
1215
|
-
// last_item.neighborIndexList.bottom = []; // 清除无效项
|
|
1216
|
-
// console.log('cchtest bottom add 2', last_down_idx)
|
|
1217
|
-
// last_item.neighborIndexList.bottom.push(last_down_idx);
|
|
1218
|
-
// }
|
|
1219
|
-
// } else {
|
|
1220
|
-
// // vertical
|
|
1221
|
-
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1222
|
-
// const pre_row_item = template_list[k];
|
|
1223
|
-
// if (pre_row_item.focusable) {
|
|
1224
|
-
// if (
|
|
1225
|
-
// pre_row_item.yPos + pre_row_item.height <
|
|
1226
|
-
// last_item.yPos + last_item.height
|
|
1227
|
-
// ) {
|
|
1228
|
-
// if (pre_row_item.neighborIndexList.bottom.length === 0) {
|
|
1229
|
-
// console.log('cchtest bottom add 3', last_item_index)
|
|
1230
|
-
// pre_row_item.neighborIndexList.bottom.push(last_item_index);
|
|
1231
|
-
// }
|
|
1232
|
-
// }
|
|
1233
|
-
// }
|
|
1234
|
-
// }
|
|
1235
|
-
// }
|
|
1236
1203
|
}
|
|
1237
1204
|
|
|
1238
1205
|
/**
|
|
@@ -1245,47 +1212,76 @@ class TemplateParser {
|
|
|
1245
1212
|
* @param {int} base_item_id Item的Id
|
|
1246
1213
|
* @param {int} vertical_offset 纵向偏移(-1为向上,1为向下)
|
|
1247
1214
|
* @param {int} horizontal_offset 横向偏移(-1为向左,1为向右)
|
|
1248
|
-
* @param {
|
|
1215
|
+
* @param {int} focus_move_type 焦点移动设置
|
|
1249
1216
|
* @return {int} 下一个Item的Id,-1为该方向未找到Item(到达边缘)
|
|
1250
1217
|
* */
|
|
1251
|
-
GetNextItem(
|
|
1218
|
+
GetNextItem(
|
|
1219
|
+
base_item_id,
|
|
1220
|
+
vertical_offset,
|
|
1221
|
+
horizontal_offset,
|
|
1222
|
+
focus_move_type
|
|
1223
|
+
) {
|
|
1252
1224
|
if (vertical_offset === 0 && horizontal_offset === 0)
|
|
1253
1225
|
console.log("GetNextItem(): offset is 0");
|
|
1254
1226
|
// Forge.ThrowError("GetNextItem(): offset is 0");
|
|
1255
1227
|
|
|
1256
1228
|
if (vertical_offset !== 0 && horizontal_offset !== 0) {
|
|
1257
1229
|
console.log(
|
|
1258
|
-
"GetNextItem(): not support change vertical and horizontal
|
|
1230
|
+
"GetNextItem(): not support change vertical and horizontal at the same time"
|
|
1259
1231
|
);
|
|
1260
1232
|
// Forge.ThrowError("GetNextItem(): not support change vertical and horizontal and the same time");
|
|
1261
1233
|
}
|
|
1262
1234
|
|
|
1263
|
-
const
|
|
1235
|
+
const item_index = this.IdToIndex(base_item_id);
|
|
1264
1236
|
const offset = vertical_offset !== 0 ? vertical_offset : horizontal_offset;
|
|
1265
1237
|
let next_template_item = this._GetNextItem(
|
|
1266
|
-
|
|
1238
|
+
item_index,
|
|
1267
1239
|
offset,
|
|
1268
1240
|
vertical_offset !== 0
|
|
1269
1241
|
);
|
|
1242
|
+
const is_vertical = this._Template.Orient.type === VERTICAL;
|
|
1270
1243
|
|
|
1271
|
-
if (
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1244
|
+
if (next_template_item === null) {
|
|
1245
|
+
// 在次方向的焦点移动才会loop
|
|
1246
|
+
if (
|
|
1247
|
+
is_vertical &&
|
|
1248
|
+
focus_move_type & FocusMoveType.ROW_LOOP &&
|
|
1249
|
+
horizontal_offset != 0
|
|
1250
|
+
) {
|
|
1251
|
+
next_template_item = this._GetNextLoopItem(
|
|
1252
|
+
item_index,
|
|
1253
|
+
horizontal_offset,
|
|
1254
|
+
is_vertical
|
|
1276
1255
|
);
|
|
1277
|
-
} else
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1256
|
+
} else if (
|
|
1257
|
+
!is_vertical &&
|
|
1258
|
+
focus_move_type & FocusMoveType.COLUMN_LOOP &&
|
|
1259
|
+
vertical_offset != 0
|
|
1260
|
+
) {
|
|
1261
|
+
next_template_item = this._GetNextLoopItem(
|
|
1262
|
+
item_index,
|
|
1263
|
+
vertical_offset,
|
|
1264
|
+
is_vertical
|
|
1281
1265
|
);
|
|
1282
1266
|
}
|
|
1283
1267
|
}
|
|
1284
1268
|
|
|
1285
1269
|
if (next_template_item === null) {
|
|
1286
|
-
|
|
1270
|
+
// 临近行的焦点移动
|
|
1271
|
+
if (
|
|
1272
|
+
vertical_offset != 0 &&
|
|
1273
|
+
focus_move_type & FocusMoveType.ROW_FIND_NEAR
|
|
1274
|
+
) {
|
|
1275
|
+
next_template_item = this._GetNearLineItem(item_index, vertical_offset, true);
|
|
1276
|
+
} else if (
|
|
1277
|
+
horizontal_offset != 0 &&
|
|
1278
|
+
focus_move_type & FocusMoveType.COLUMN_FIND_NEAR
|
|
1279
|
+
) {
|
|
1280
|
+
next_template_item = this._GetNearLineItem(item_index, horizontal_offset, false);
|
|
1281
|
+
}
|
|
1287
1282
|
}
|
|
1288
|
-
|
|
1283
|
+
|
|
1284
|
+
return next_template_item;
|
|
1289
1285
|
}
|
|
1290
1286
|
|
|
1291
1287
|
_GetNextItem(index, offset, vertical) {
|
|
@@ -1451,94 +1447,115 @@ class TemplateParser {
|
|
|
1451
1447
|
return null;
|
|
1452
1448
|
}
|
|
1453
1449
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
if (offset > 0) {
|
|
1461
|
-
direction = "top";
|
|
1462
|
-
}
|
|
1463
|
-
let found = false;
|
|
1464
|
-
let next_index = -1;
|
|
1450
|
+
_GetItemDistance(item1, item2) {
|
|
1451
|
+
return (
|
|
1452
|
+
Math.pow(item1.centerXPos - item2.centerXPos, 2) +
|
|
1453
|
+
Math.pow(item1.centerYPos - item2.centerYPos, 2)
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1465
1456
|
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1457
|
+
_GetTotalNeighbor(index, direction) {
|
|
1458
|
+
const item = this._Template.List[index];
|
|
1459
|
+
return item.neighborIndexList[direction].concat(
|
|
1460
|
+
item.tmpNeighborIndexList[direction]
|
|
1461
|
+
);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
_GetNearestItem(target_item_index, item_index_list) {
|
|
1465
|
+
let nearest_index = -1,
|
|
1466
|
+
min_distance = Number.POSITIVE_INFINITY;
|
|
1467
|
+
let target_item = this._Template.List[target_item_index];
|
|
1468
|
+
for (let i of item_index_list) {
|
|
1469
|
+
const d = this._GetItemDistance(this._Template.List[i], target_item);
|
|
1470
|
+
if (d < min_distance) {
|
|
1471
|
+
nearest_index = i;
|
|
1472
|
+
min_distance = d;
|
|
1473
|
+
}
|
|
1472
1474
|
}
|
|
1475
|
+
return nearest_index;
|
|
1476
|
+
}
|
|
1473
1477
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1478
|
+
_GetNextLoopItem(index, offset, is_vertical) {
|
|
1479
|
+
const template_list = this._Template.List;
|
|
1480
|
+
const base_item = template_list[index];
|
|
1481
|
+
let search_direction = is_vertical ? "right" : "bottom";
|
|
1482
|
+
let start_direction = is_vertical ? "top" : "left";
|
|
1483
|
+
if (offset > 0) {
|
|
1484
|
+
search_direction = is_vertical ? "left" : "top";
|
|
1485
|
+
start_direction = is_vertical ? "bottom" : "right";
|
|
1486
|
+
}
|
|
1487
|
+
let target_index = -1;
|
|
1488
|
+
let focusable_target = -1;
|
|
1489
|
+
let start_index = -1;
|
|
1490
|
+
let neighbor_list = [];
|
|
1491
|
+
//寻找下一列的起始item
|
|
1492
|
+
neighbor_list = this._GetTotalNeighbor(index, search_direction);
|
|
1493
|
+
while (start_index < 0 && neighbor_list.length > 0) {
|
|
1494
|
+
for (let i of neighbor_list) {
|
|
1495
|
+
if (this._GetTotalNeighbor(i, start_direction).length > 0) {
|
|
1496
|
+
start_index = i;
|
|
1485
1497
|
break;
|
|
1498
|
+
} else {
|
|
1499
|
+
//TODO 是否要用递归
|
|
1500
|
+
neighbor_list = this._GetTotalNeighbor(i, search_direction);
|
|
1486
1501
|
}
|
|
1487
1502
|
}
|
|
1488
1503
|
}
|
|
1504
|
+
if (start_index >= 0) {
|
|
1505
|
+
neighbor_list = this._GetTotalNeighbor(start_index, start_direction);
|
|
1506
|
+
|
|
1507
|
+
//寻找最近的neighbor
|
|
1508
|
+
let nearest_index = -1,
|
|
1509
|
+
min_distance = Number.POSITIVE_INFINITY;
|
|
1510
|
+
for (let i of neighbor_list) {
|
|
1511
|
+
const d = this._GetItemDistance(template_list[i], base_item);
|
|
1512
|
+
if (d < min_distance) {
|
|
1513
|
+
nearest_index = i;
|
|
1514
|
+
min_distance = d;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1489
1517
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1518
|
+
neighbor_list = this._GetTotalNeighbor(nearest_index, search_direction);
|
|
1519
|
+
while (neighbor_list.length > 0) {
|
|
1520
|
+
target_index = this._GetNearestItem(nearest_index, neighbor_list);
|
|
1521
|
+
if (template_list[target_index].focusable) {
|
|
1522
|
+
focusable_target = target_index;
|
|
1523
|
+
}
|
|
1524
|
+
neighbor_list = this._GetTotalNeighbor(target_index, search_direction);
|
|
1525
|
+
}
|
|
1526
|
+
if (focusable_target >= 0) {
|
|
1527
|
+
return template_list[focusable_target];
|
|
1528
|
+
} else if (target_index >= 0) {
|
|
1529
|
+
return this._GetNextLoopItem(target_index, offset, is_vertical);
|
|
1494
1530
|
}
|
|
1495
|
-
return template_list[next_index];
|
|
1496
1531
|
}
|
|
1497
1532
|
return null;
|
|
1498
1533
|
}
|
|
1499
1534
|
|
|
1500
|
-
|
|
1535
|
+
//获取临近行的item
|
|
1536
|
+
_GetNearLineItem(index, offset, is_vertical) {
|
|
1501
1537
|
const template_list = this._Template.List;
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
let direction = "right";
|
|
1538
|
+
let search_direction = is_vertical ? "right" : "bottom";
|
|
1539
|
+
let start_direction = is_vertical ? "top" : "left";
|
|
1505
1540
|
if (offset > 0) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
let
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
next_index = neighbor_list[i];
|
|
1522
|
-
const checking_item = template_list[next_index];
|
|
1523
|
-
if (
|
|
1524
|
-
center_y <= checking_item.yPos + checking_item.height - 1 &&
|
|
1525
|
-
center_y >= checking_item.yPos
|
|
1526
|
-
) {
|
|
1527
|
-
neighbor_list =
|
|
1528
|
-
template_list[next_index].neighborIndexList[direction];
|
|
1529
|
-
found = true;
|
|
1530
|
-
break;
|
|
1541
|
+
search_direction = is_vertical ? "left" : "top";
|
|
1542
|
+
start_direction = is_vertical ? "bottom" : "right";
|
|
1543
|
+
}
|
|
1544
|
+
let start_index = -1;
|
|
1545
|
+
let neighbor_list = [];
|
|
1546
|
+
//寻找下一列的起始item
|
|
1547
|
+
neighbor_list = this._GetTotalNeighbor(index, search_direction);
|
|
1548
|
+
while (start_index < 0 && neighbor_list.length > 0) {
|
|
1549
|
+
for (let i of neighbor_list) {
|
|
1550
|
+
const n = this._GetTotalNeighbor(i, start_direction);
|
|
1551
|
+
if (n.length > 0) {
|
|
1552
|
+
return template_list[this._GetNearestItem(index, n)];
|
|
1553
|
+
} else {
|
|
1554
|
+
//TODO 是否要用递归
|
|
1555
|
+
neighbor_list = this._GetTotalNeighbor(i, search_direction);
|
|
1531
1556
|
}
|
|
1532
1557
|
}
|
|
1533
1558
|
}
|
|
1534
|
-
|
|
1535
|
-
if (found) {
|
|
1536
|
-
if (!template_list[next_index].focusable) {
|
|
1537
|
-
// 如果是占位符,则查找占位符的下一个
|
|
1538
|
-
return this._GetNextLoopItemHorizontal(next_index, offset);
|
|
1539
|
-
}
|
|
1540
|
-
return template_list[next_index];
|
|
1541
|
-
}
|
|
1542
1559
|
return null;
|
|
1543
1560
|
}
|
|
1544
1561
|
|
|
@@ -1846,7 +1863,14 @@ class TemplateParser {
|
|
|
1846
1863
|
}
|
|
1847
1864
|
|
|
1848
1865
|
class TemplateItemAdder {
|
|
1849
|
-
constructor(
|
|
1866
|
+
constructor(
|
|
1867
|
+
template_parser,
|
|
1868
|
+
data,
|
|
1869
|
+
measure_func,
|
|
1870
|
+
page_range,
|
|
1871
|
+
side_effect,
|
|
1872
|
+
id
|
|
1873
|
+
) {
|
|
1850
1874
|
this._TemplateParser = template_parser;
|
|
1851
1875
|
this._Data = data;
|
|
1852
1876
|
this._PageRange = page_range;
|
|
@@ -1859,6 +1883,7 @@ class TemplateItemAdder {
|
|
|
1859
1883
|
this._TemplateParser._Template.Orient.type === HORIZONTAL
|
|
1860
1884
|
? "xPos"
|
|
1861
1885
|
: "yPos";
|
|
1886
|
+
this._ID = id;
|
|
1862
1887
|
}
|
|
1863
1888
|
|
|
1864
1889
|
tryAddItem(cur_item = null, page_num = 1) {
|
|
@@ -1869,15 +1894,23 @@ class TemplateItemAdder {
|
|
|
1869
1894
|
cur_item[this._Key] >= (this._CurPage - 1) * this._PageRange)
|
|
1870
1895
|
) {
|
|
1871
1896
|
while (this._CurIndex < this._Data.length) {
|
|
1872
|
-
|
|
1873
|
-
this.
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
this._CurPage
|
|
1880
|
-
|
|
1897
|
+
try {
|
|
1898
|
+
let item = this._TemplateParser.ParseTemplateItem(
|
|
1899
|
+
this._MeasureFunc(this._Data[this._CurIndex]),
|
|
1900
|
+
this._Data[this._CurIndex]
|
|
1901
|
+
);
|
|
1902
|
+
this._SideEffect?.(item);
|
|
1903
|
+
this._CurIndex++;
|
|
1904
|
+
if (item[this._Key] >= (this._CurPage + page_num) * this._PageRange) {
|
|
1905
|
+
this._CurPage += page_num;
|
|
1906
|
+
break;
|
|
1907
|
+
}
|
|
1908
|
+
} catch (e) {
|
|
1909
|
+
console.error(
|
|
1910
|
+
`MetroWidget: ${this._ID} parse template item ${this._CurIndex} failed. data: `,
|
|
1911
|
+
this._Data
|
|
1912
|
+
);
|
|
1913
|
+
throw e;
|
|
1881
1914
|
}
|
|
1882
1915
|
}
|
|
1883
1916
|
this._TemplateParser.CalculateNeighborWhenAddStop();
|
|
@@ -1899,14 +1932,22 @@ class TemplateItemAdder {
|
|
|
1899
1932
|
let added = false;
|
|
1900
1933
|
while (this._CurIndex <= _index) {
|
|
1901
1934
|
added = true;
|
|
1902
|
-
|
|
1903
|
-
this.
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
this._CurPage
|
|
1935
|
+
try {
|
|
1936
|
+
let item = this._TemplateParser.ParseTemplateItem(
|
|
1937
|
+
this._MeasureFunc(this._Data[this._CurIndex]),
|
|
1938
|
+
this._Data[this._CurIndex]
|
|
1939
|
+
);
|
|
1940
|
+
this._SideEffect?.(item);
|
|
1941
|
+
this._CurIndex++;
|
|
1942
|
+
if (item[this._Key] >= (this._CurPage + 1) * this._PageRange) {
|
|
1943
|
+
this._CurPage++;
|
|
1944
|
+
}
|
|
1945
|
+
} catch (e) {
|
|
1946
|
+
console.error(
|
|
1947
|
+
`MetroWidget: ${this._ID} parse template item ${this._CurIndex} failed. data:`,
|
|
1948
|
+
this._Data
|
|
1949
|
+
);
|
|
1950
|
+
throw e;
|
|
1910
1951
|
}
|
|
1911
1952
|
}
|
|
1912
1953
|
if (added) {
|
|
@@ -1924,16 +1965,24 @@ class TemplateItemAdder {
|
|
|
1924
1965
|
let cur_id = last_id;
|
|
1925
1966
|
while (cur_id < _id && this._CurIndex < this._Data.length) {
|
|
1926
1967
|
added = true;
|
|
1927
|
-
|
|
1928
|
-
this.
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
this._CurPage
|
|
1968
|
+
try {
|
|
1969
|
+
const item = this._TemplateParser.ParseTemplateItem(
|
|
1970
|
+
this._MeasureFunc(this._Data[this._CurIndex]),
|
|
1971
|
+
this._Data[this._CurIndex]
|
|
1972
|
+
);
|
|
1973
|
+
cur_id = item.id;
|
|
1974
|
+
this._SideEffect?.(item);
|
|
1975
|
+
if (item[this._Key] >= (this._CurPage + 1) * this._PageRange) {
|
|
1976
|
+
this._CurPage++;
|
|
1977
|
+
}
|
|
1978
|
+
this._CurIndex++;
|
|
1979
|
+
} catch (e) {
|
|
1980
|
+
console.error(
|
|
1981
|
+
`MetroWidget: ${this._ID} parse template item ${this._CurIndex} failed. data:`,
|
|
1982
|
+
this._Data
|
|
1983
|
+
);
|
|
1984
|
+
throw e;
|
|
1935
1985
|
}
|
|
1936
|
-
this._CurIndex++;
|
|
1937
1986
|
}
|
|
1938
1987
|
if (added) {
|
|
1939
1988
|
this._TemplateParser.CalculateNeighborWhenAddStop();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2020-12-30 14:08:38
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-22 09:57:18
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
class BaseDispatcher {
|
|
@@ -75,17 +75,16 @@ function getPositionRelativeToView(divElement, targetElement) {
|
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
let element = divElement;
|
|
78
|
-
const elementLayoutParams = element.jsvMaskView.GetLayoutParams();
|
|
79
78
|
let position = {
|
|
80
79
|
left: 0,
|
|
81
80
|
top: 0,
|
|
82
|
-
width:
|
|
83
|
-
height:
|
|
81
|
+
width: element.style.width,
|
|
82
|
+
height: element.style.height,
|
|
84
83
|
};
|
|
85
84
|
while (element && element !== targetElement) {
|
|
86
85
|
position.left += element.style.left ? element.style.left : 0;
|
|
87
86
|
position.top += element.style.top ? element.style.top : 0;
|
|
88
|
-
element = element.
|
|
87
|
+
element = element.parentNode;
|
|
89
88
|
}
|
|
90
89
|
return position;
|
|
91
90
|
}
|
|
@@ -185,6 +184,14 @@ class FixPositionSlide extends SlideSetting {
|
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
|
|
187
|
+
const FocusMoveType = {
|
|
188
|
+
NO_ADJUST: 0x00000000,
|
|
189
|
+
COLUMN_LOOP: 0x00000001,
|
|
190
|
+
ROW_LOOP: 0x00000001 << 1,
|
|
191
|
+
COLUMN_FIND_NEAR: 0x00000001 << 2,
|
|
192
|
+
ROW_FIND_NEAR: 0x00000001 << 3,
|
|
193
|
+
};
|
|
194
|
+
|
|
188
195
|
// randomColor() {
|
|
189
196
|
// let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
190
197
|
// return (
|
|
@@ -204,4 +211,5 @@ export {
|
|
|
204
211
|
WholePageSlide,
|
|
205
212
|
SeamlessSlide,
|
|
206
213
|
FixPositionSlide,
|
|
214
|
+
FocusMoveType,
|
|
207
215
|
};
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-06-16 10:07:20
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07
|
|
5
|
+
* @LastEditTime: 2022-11-07 14:50:02
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
export * from "./WidgetCommon";
|
|
9
|
-
export * from "./
|
|
9
|
+
export * from "./MetroWidget/Dispatcher";
|
|
10
10
|
|
|
11
11
|
export { default as SimpleWidget } from "./MetroWidget/MetroWidget.vue";
|
|
12
12
|
export { default as MetroWidget } from "./MetroWidget/MetroWidget.vue";
|
|
13
|
+
export { METRO_WIDGET } from "./MetroWidget/Const.js";
|
|
13
14
|
|
|
14
15
|
export { default as JsvFocusBlock } from "./JsvFocusBlock.vue";
|
|
15
16
|
export { jsvCreateFocusManager, useFocusHub } from "./JsvFocusManager";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @LastEditTime: 2022-2-24 14:00:00
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
|
-
import { JsvWidgetWrapperGroup } from '
|
|
8
|
+
import { JsvWidgetWrapperGroup } from '../JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js';
|
|
9
9
|
//考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
|
|
10
10
|
import * as BrowserJsvPlayer from "./JsvPlayer/JsvPlayerBrowser.vue";
|
|
11
11
|
|