@shijiu/jsview-vue 0.9.684 → 0.9.783
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/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/jsv-engine-js-browser.js +6 -0
- package/dom/target_core_revision.js +4 -4
- package/loader/loader.js +4 -0
- package/package.json +1 -1
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +1 -1
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/img/ImageGroup.vue +2 -2
- package/samples/Basic/components/img/ImgLayout.vue +79 -15
- package/samples/Basic/components/text/TextDirection.vue +104 -0
- package/samples/Basic/components/text/TextEmoji.vue +1 -1
- package/samples/Basic/components/text/TextGroup1.vue +1 -1
- package/samples/Basic/components/text/TextGroup2.vue +11 -1
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +11 -11
- package/samples/DemoHomepage/App.vue +67 -8
- package/samples/DemoHomepage/components/TabFrame.vue +7 -0
- package/samples/DemoHomepage/router.js +27 -26
- package/samples/DemoHomepage/views/Homepage.vue +89 -98
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +3 -3
- package/samples/FocusBlockDemos/AutoFocus/App.vue +51 -0
- package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +42 -0
- package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
- package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +78 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
- 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 +15 -11
- package/samples/Input/InputPanel.vue +1 -1
- 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 +34 -3
- package/samples/Marquee/longText.js +2 -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 +3 -3
- package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +5 -5
- package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +3 -21
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +5 -5
- package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +8 -4
- package/samples/MetroWidgetDemos/basic/App.vue +162 -0
- package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
- package/samples/MetroWidgetDemos/direction/App.vue +158 -0
- package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
- package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
- package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +17 -21
- package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +13 -32
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +12 -12
- package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
- package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
- package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
- package/samples/MetroWidgetDemos/index.js +6 -0
- package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
- package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
- package/samples/MetroWidgetDemos/padding/App.vue +222 -0
- package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
- package/samples/MetroWidgetDemos/routeList.js +64 -0
- package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
- package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
- package/samples/NinePatchDemo/App.vue +78 -122
- package/samples/NinePatchDemo/Item.vue +29 -27
- package/samples/Preload/App.vue +1 -1
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/SoundPool/App.vue +3 -3
- package/samples/SpriteImage/App.vue +5 -0
- package/samples/Swiper/App.vue +148 -0
- package/samples/TextBox/App.vue +2 -1
- package/samples/TextureAnimation/App2.vue +1 -1
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +33 -47
- 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/VideoDemo/components/Controllor.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +3 -3
- package/scripts/jsview-run-android.js +5 -4
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +4 -4
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +79 -50
- package/utils/JsViewEngineWidget/TemplateParser.js +144 -147
- package/utils/JsViewEngineWidget/WidgetCommon.js +12 -3
- package/utils/JsViewPlugin/BrowserPluginLoader.js +4 -2
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +302 -0
- package/utils/JsViewPlugin/JsvAudio/CheckType.js +68 -0
- package/utils/JsViewPlugin/JsvAudio/Events.js +17 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +176 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +40 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +46 -0
- package/utils/JsViewPlugin/JsvAudio/PluginLoader.js +140 -0
- package/utils/JsViewPlugin/JsvAudio/index.js +26 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +24 -0
- package/utils/JsViewPlugin/JsvPlayer/index.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +34 -8
- package/utils/JsViewVueTools/JsvImpactTracer.js +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +46 -8
- package/utils/JsViewVueTools/JsvStyleClass.js +9 -0
- package/utils/{JsViewVueWidget/utils/text.js → JsViewVueTools/JsvTextTools.js} +24 -4
- package/utils/JsViewVueTools/TypeCheckAndSet.js +3 -3
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +5 -7
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +20 -22
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +4 -4
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -9
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +1 -1
- package/utils/JsViewVueWidget/JsvMarquee.vue +91 -20
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvNinePatch.vue +63 -53
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +10 -5
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +116 -80
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +1 -1
- package/utils/JsViewVueWidget/JsvTextBox.vue +11 -31
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +2 -2
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +5 -5
- package/utils/JsViewVueWidget/index.js +8 -8
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
- package/utils/JsViewVueWidget/utils/index.js +0 -8
|
@@ -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) {
|
|
@@ -1064,8 +1064,13 @@ class TemplateParser {
|
|
|
1064
1064
|
return this._Template.List.length;
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
IdToIndex(id) {
|
|
1068
|
+
const index = this._Template.IdsMap[id];
|
|
1069
|
+
if (typeof index !== "undefined") {
|
|
1070
|
+
return index;
|
|
1071
|
+
} else {
|
|
1072
|
+
return -1;
|
|
1073
|
+
}
|
|
1069
1074
|
}
|
|
1070
1075
|
|
|
1071
1076
|
/**
|
|
@@ -1200,64 +1205,6 @@ class TemplateParser {
|
|
|
1200
1205
|
this._FindFocusableNeighbor("right", item);
|
|
1201
1206
|
}
|
|
1202
1207
|
}
|
|
1203
|
-
// if (this._Template.Orient.type !== VERTICAL) {
|
|
1204
|
-
// // 从后向前找(最后一项不用检查)
|
|
1205
|
-
// // 如果向下未找到对象,则查找最后一行的最后一项
|
|
1206
|
-
// let last_down_idx = null;
|
|
1207
|
-
// let min_distance = -1;
|
|
1208
|
-
// let distance = 0;
|
|
1209
|
-
// // 向下操作 只检查最后一项
|
|
1210
|
-
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1211
|
-
// const pre_col_item = template_list[k];
|
|
1212
|
-
// if (pre_col_item.focusable) {
|
|
1213
|
-
// if (pre_col_item.yPos >= last_item.yPos + last_item.height) {
|
|
1214
|
-
// if (
|
|
1215
|
-
// pre_col_item.neighborIndexList.right.length === 0 ||
|
|
1216
|
-
// !this._CheckIdsHasFocusable(
|
|
1217
|
-
// pre_col_item.neighborIndexList.right
|
|
1218
|
-
// ) ||
|
|
1219
|
-
// this._IsInNeighborList(
|
|
1220
|
-
// pre_col_item.neighborIndexList.right,
|
|
1221
|
-
// last_item_index
|
|
1222
|
-
// )
|
|
1223
|
-
// ) {
|
|
1224
|
-
// // 有邻居中有last_item_index
|
|
1225
|
-
// distance =
|
|
1226
|
-
// (last_item.xPos - pre_col_item.xPos) ** 2 +
|
|
1227
|
-
// (last_item.yPos - pre_col_item.yPos) ** 2;
|
|
1228
|
-
// if (min_distance === -1) {
|
|
1229
|
-
// min_distance = distance;
|
|
1230
|
-
// last_down_idx = k;
|
|
1231
|
-
// } else if (min_distance > distance) {
|
|
1232
|
-
// min_distance = distance;
|
|
1233
|
-
// last_down_idx = k;
|
|
1234
|
-
// }
|
|
1235
|
-
// }
|
|
1236
|
-
// }
|
|
1237
|
-
// }
|
|
1238
|
-
// }
|
|
1239
|
-
// if (last_down_idx) {
|
|
1240
|
-
// last_item.neighborIndexList.bottom = []; // 清除无效项
|
|
1241
|
-
// console.log('cchtest bottom add 2', last_down_idx)
|
|
1242
|
-
// last_item.neighborIndexList.bottom.push(last_down_idx);
|
|
1243
|
-
// }
|
|
1244
|
-
// } else {
|
|
1245
|
-
// // vertical
|
|
1246
|
-
// for (let k = last_item_index - 1; k >= 0; k--) {
|
|
1247
|
-
// const pre_row_item = template_list[k];
|
|
1248
|
-
// if (pre_row_item.focusable) {
|
|
1249
|
-
// if (
|
|
1250
|
-
// pre_row_item.yPos + pre_row_item.height <
|
|
1251
|
-
// last_item.yPos + last_item.height
|
|
1252
|
-
// ) {
|
|
1253
|
-
// if (pre_row_item.neighborIndexList.bottom.length === 0) {
|
|
1254
|
-
// console.log('cchtest bottom add 3', last_item_index)
|
|
1255
|
-
// pre_row_item.neighborIndexList.bottom.push(last_item_index);
|
|
1256
|
-
// }
|
|
1257
|
-
// }
|
|
1258
|
-
// }
|
|
1259
|
-
// }
|
|
1260
|
-
// }
|
|
1261
1208
|
}
|
|
1262
1209
|
|
|
1263
1210
|
/**
|
|
@@ -1270,47 +1217,76 @@ class TemplateParser {
|
|
|
1270
1217
|
* @param {int} base_item_id Item的Id
|
|
1271
1218
|
* @param {int} vertical_offset 纵向偏移(-1为向上,1为向下)
|
|
1272
1219
|
* @param {int} horizontal_offset 横向偏移(-1为向左,1为向右)
|
|
1273
|
-
* @param {
|
|
1220
|
+
* @param {int} focus_move_type 焦点移动设置
|
|
1274
1221
|
* @return {int} 下一个Item的Id,-1为该方向未找到Item(到达边缘)
|
|
1275
1222
|
* */
|
|
1276
|
-
GetNextItem(
|
|
1223
|
+
GetNextItem(
|
|
1224
|
+
base_item_id,
|
|
1225
|
+
vertical_offset,
|
|
1226
|
+
horizontal_offset,
|
|
1227
|
+
focus_move_type
|
|
1228
|
+
) {
|
|
1277
1229
|
if (vertical_offset === 0 && horizontal_offset === 0)
|
|
1278
1230
|
console.log("GetNextItem(): offset is 0");
|
|
1279
1231
|
// Forge.ThrowError("GetNextItem(): offset is 0");
|
|
1280
1232
|
|
|
1281
1233
|
if (vertical_offset !== 0 && horizontal_offset !== 0) {
|
|
1282
1234
|
console.log(
|
|
1283
|
-
"GetNextItem(): not support change vertical and horizontal
|
|
1235
|
+
"GetNextItem(): not support change vertical and horizontal at the same time"
|
|
1284
1236
|
);
|
|
1285
1237
|
// Forge.ThrowError("GetNextItem(): not support change vertical and horizontal and the same time");
|
|
1286
1238
|
}
|
|
1287
1239
|
|
|
1288
|
-
const
|
|
1240
|
+
const item_index = this.IdToIndex(base_item_id);
|
|
1289
1241
|
const offset = vertical_offset !== 0 ? vertical_offset : horizontal_offset;
|
|
1290
1242
|
let next_template_item = this._GetNextItem(
|
|
1291
|
-
|
|
1243
|
+
item_index,
|
|
1292
1244
|
offset,
|
|
1293
1245
|
vertical_offset !== 0
|
|
1294
1246
|
);
|
|
1247
|
+
const is_vertical = this._Template.Orient.type === VERTICAL;
|
|
1295
1248
|
|
|
1296
|
-
if (
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1249
|
+
if (next_template_item === null) {
|
|
1250
|
+
// 在次方向的焦点移动才会loop
|
|
1251
|
+
if (
|
|
1252
|
+
is_vertical &&
|
|
1253
|
+
focus_move_type & FocusMoveType.ROW_LOOP &&
|
|
1254
|
+
horizontal_offset != 0
|
|
1255
|
+
) {
|
|
1256
|
+
next_template_item = this._GetNextLoopItem(
|
|
1257
|
+
item_index,
|
|
1258
|
+
horizontal_offset,
|
|
1259
|
+
is_vertical
|
|
1301
1260
|
);
|
|
1302
|
-
} else
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1261
|
+
} else if (
|
|
1262
|
+
!is_vertical &&
|
|
1263
|
+
focus_move_type & FocusMoveType.COLUMN_LOOP &&
|
|
1264
|
+
vertical_offset != 0
|
|
1265
|
+
) {
|
|
1266
|
+
next_template_item = this._GetNextLoopItem(
|
|
1267
|
+
item_index,
|
|
1268
|
+
vertical_offset,
|
|
1269
|
+
is_vertical
|
|
1306
1270
|
);
|
|
1307
1271
|
}
|
|
1308
1272
|
}
|
|
1309
1273
|
|
|
1310
1274
|
if (next_template_item === null) {
|
|
1311
|
-
|
|
1275
|
+
// 临近行的焦点移动
|
|
1276
|
+
if (
|
|
1277
|
+
vertical_offset != 0 &&
|
|
1278
|
+
focus_move_type & FocusMoveType.ROW_FIND_NEAR
|
|
1279
|
+
) {
|
|
1280
|
+
next_template_item = this._GetNearLineItem(item_index, vertical_offset, true);
|
|
1281
|
+
} else if (
|
|
1282
|
+
horizontal_offset != 0 &&
|
|
1283
|
+
focus_move_type & FocusMoveType.COLUMN_FIND_NEAR
|
|
1284
|
+
) {
|
|
1285
|
+
next_template_item = this._GetNearLineItem(item_index, horizontal_offset, false);
|
|
1286
|
+
}
|
|
1312
1287
|
}
|
|
1313
|
-
|
|
1288
|
+
|
|
1289
|
+
return next_template_item;
|
|
1314
1290
|
}
|
|
1315
1291
|
|
|
1316
1292
|
_GetNextItem(index, offset, vertical) {
|
|
@@ -1476,94 +1452,115 @@ class TemplateParser {
|
|
|
1476
1452
|
return null;
|
|
1477
1453
|
}
|
|
1478
1454
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
if (offset > 0) {
|
|
1486
|
-
direction = "top";
|
|
1487
|
-
}
|
|
1488
|
-
let found = false;
|
|
1489
|
-
let next_index = -1;
|
|
1455
|
+
_GetItemDistance(item1, item2) {
|
|
1456
|
+
return (
|
|
1457
|
+
Math.pow(item1.centerXPos - item2.centerXPos, 2) +
|
|
1458
|
+
Math.pow(item1.centerYPos - item2.centerYPos, 2)
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1490
1461
|
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1462
|
+
_GetTotalNeighbor(index, direction) {
|
|
1463
|
+
const item = this._Template.List[index];
|
|
1464
|
+
return item.neighborIndexList[direction].concat(
|
|
1465
|
+
item.tmpNeighborIndexList[direction]
|
|
1466
|
+
);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
_GetNearestItem(target_item_index, item_index_list) {
|
|
1470
|
+
let nearest_index = -1,
|
|
1471
|
+
min_distance = Number.POSITIVE_INFINITY;
|
|
1472
|
+
let target_item = this._Template.List[target_item_index];
|
|
1473
|
+
for (let i of item_index_list) {
|
|
1474
|
+
const d = this._GetItemDistance(this._Template.List[i], target_item);
|
|
1475
|
+
if (d < min_distance) {
|
|
1476
|
+
nearest_index = i;
|
|
1477
|
+
min_distance = d;
|
|
1478
|
+
}
|
|
1497
1479
|
}
|
|
1480
|
+
return nearest_index;
|
|
1481
|
+
}
|
|
1498
1482
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1483
|
+
_GetNextLoopItem(index, offset, is_vertical) {
|
|
1484
|
+
const template_list = this._Template.List;
|
|
1485
|
+
const base_item = template_list[index];
|
|
1486
|
+
let search_direction = is_vertical ? "right" : "bottom";
|
|
1487
|
+
let start_direction = is_vertical ? "top" : "left";
|
|
1488
|
+
if (offset > 0) {
|
|
1489
|
+
search_direction = is_vertical ? "left" : "top";
|
|
1490
|
+
start_direction = is_vertical ? "bottom" : "right";
|
|
1491
|
+
}
|
|
1492
|
+
let target_index = -1;
|
|
1493
|
+
let focusable_target = -1;
|
|
1494
|
+
let start_index = -1;
|
|
1495
|
+
let neighbor_list = [];
|
|
1496
|
+
//寻找下一列的起始item
|
|
1497
|
+
neighbor_list = this._GetTotalNeighbor(index, search_direction);
|
|
1498
|
+
while (start_index < 0 && neighbor_list.length > 0) {
|
|
1499
|
+
for (let i of neighbor_list) {
|
|
1500
|
+
if (this._GetTotalNeighbor(i, start_direction).length > 0) {
|
|
1501
|
+
start_index = i;
|
|
1510
1502
|
break;
|
|
1503
|
+
} else {
|
|
1504
|
+
//TODO 是否要用递归
|
|
1505
|
+
neighbor_list = this._GetTotalNeighbor(i, search_direction);
|
|
1511
1506
|
}
|
|
1512
1507
|
}
|
|
1513
1508
|
}
|
|
1509
|
+
if (start_index >= 0) {
|
|
1510
|
+
neighbor_list = this._GetTotalNeighbor(start_index, start_direction);
|
|
1511
|
+
|
|
1512
|
+
//寻找最近的neighbor
|
|
1513
|
+
let nearest_index = -1,
|
|
1514
|
+
min_distance = Number.POSITIVE_INFINITY;
|
|
1515
|
+
for (let i of neighbor_list) {
|
|
1516
|
+
const d = this._GetItemDistance(template_list[i], base_item);
|
|
1517
|
+
if (d < min_distance) {
|
|
1518
|
+
nearest_index = i;
|
|
1519
|
+
min_distance = d;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1514
1522
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1523
|
+
neighbor_list = this._GetTotalNeighbor(nearest_index, search_direction);
|
|
1524
|
+
while (neighbor_list.length > 0) {
|
|
1525
|
+
target_index = this._GetNearestItem(nearest_index, neighbor_list);
|
|
1526
|
+
if (template_list[target_index].focusable) {
|
|
1527
|
+
focusable_target = target_index;
|
|
1528
|
+
}
|
|
1529
|
+
neighbor_list = this._GetTotalNeighbor(target_index, search_direction);
|
|
1530
|
+
}
|
|
1531
|
+
if (focusable_target >= 0) {
|
|
1532
|
+
return template_list[focusable_target];
|
|
1533
|
+
} else if (target_index >= 0) {
|
|
1534
|
+
return this._GetNextLoopItem(target_index, offset, is_vertical);
|
|
1519
1535
|
}
|
|
1520
|
-
return template_list[next_index];
|
|
1521
1536
|
}
|
|
1522
1537
|
return null;
|
|
1523
1538
|
}
|
|
1524
1539
|
|
|
1525
|
-
|
|
1540
|
+
//获取临近行的item
|
|
1541
|
+
_GetNearLineItem(index, offset, is_vertical) {
|
|
1526
1542
|
const template_list = this._Template.List;
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
let direction = "right";
|
|
1543
|
+
let search_direction = is_vertical ? "right" : "bottom";
|
|
1544
|
+
let start_direction = is_vertical ? "top" : "left";
|
|
1530
1545
|
if (offset > 0) {
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
let
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
next_index = neighbor_list[i];
|
|
1547
|
-
const checking_item = template_list[next_index];
|
|
1548
|
-
if (
|
|
1549
|
-
center_y <= checking_item.yPos + checking_item.height - 1 &&
|
|
1550
|
-
center_y >= checking_item.yPos
|
|
1551
|
-
) {
|
|
1552
|
-
neighbor_list =
|
|
1553
|
-
template_list[next_index].neighborIndexList[direction];
|
|
1554
|
-
found = true;
|
|
1555
|
-
break;
|
|
1546
|
+
search_direction = is_vertical ? "left" : "top";
|
|
1547
|
+
start_direction = is_vertical ? "bottom" : "right";
|
|
1548
|
+
}
|
|
1549
|
+
let start_index = -1;
|
|
1550
|
+
let neighbor_list = [];
|
|
1551
|
+
//寻找下一列的起始item
|
|
1552
|
+
neighbor_list = this._GetTotalNeighbor(index, search_direction);
|
|
1553
|
+
while (start_index < 0 && neighbor_list.length > 0) {
|
|
1554
|
+
for (let i of neighbor_list) {
|
|
1555
|
+
const n = this._GetTotalNeighbor(i, start_direction);
|
|
1556
|
+
if (n.length > 0) {
|
|
1557
|
+
return template_list[this._GetNearestItem(index, n)];
|
|
1558
|
+
} else {
|
|
1559
|
+
//TODO 是否要用递归
|
|
1560
|
+
neighbor_list = this._GetTotalNeighbor(i, search_direction);
|
|
1556
1561
|
}
|
|
1557
1562
|
}
|
|
1558
1563
|
}
|
|
1559
|
-
|
|
1560
|
-
if (found) {
|
|
1561
|
-
if (!template_list[next_index].focusable) {
|
|
1562
|
-
// 如果是占位符,则查找占位符的下一个
|
|
1563
|
-
return this._GetNextLoopItemHorizontal(next_index, offset);
|
|
1564
|
-
}
|
|
1565
|
-
return template_list[next_index];
|
|
1566
|
-
}
|
|
1567
1564
|
return null;
|
|
1568
1565
|
}
|
|
1569
1566
|
|
|
@@ -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-12-01 16:49:21
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
class BaseDispatcher {
|
|
@@ -84,7 +84,7 @@ function getPositionRelativeToView(divElement, targetElement) {
|
|
|
84
84
|
while (element && element !== targetElement) {
|
|
85
85
|
position.left += element.style.left ? element.style.left : 0;
|
|
86
86
|
position.top += element.style.top ? element.style.top : 0;
|
|
87
|
-
element = element.
|
|
87
|
+
element = element.parentNode;
|
|
88
88
|
}
|
|
89
89
|
return position;
|
|
90
90
|
}
|
|
@@ -174,7 +174,7 @@ class SeamlessSlide extends SlideSetting {
|
|
|
174
174
|
**/
|
|
175
175
|
class FixPositionSlide extends SlideSetting {
|
|
176
176
|
constructor({
|
|
177
|
-
fixPercent,
|
|
177
|
+
fixPercent = .5,
|
|
178
178
|
speed = defaultSpeed,
|
|
179
179
|
easing = defaultEasing,
|
|
180
180
|
boundaryProtect = SlideSetting.START_PROTECT | SlideSetting.END_PROTECT,
|
|
@@ -184,6 +184,14 @@ class FixPositionSlide extends SlideSetting {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
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
|
+
|
|
187
195
|
// randomColor() {
|
|
188
196
|
// let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
189
197
|
// return (
|
|
@@ -203,4 +211,5 @@ export {
|
|
|
203
211
|
WholePageSlide,
|
|
204
212
|
SeamlessSlide,
|
|
205
213
|
FixPositionSlide,
|
|
214
|
+
FocusMoveType,
|
|
206
215
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: LuDonglin
|
|
3
3
|
* @Date: 2022-2-24 14:00:00
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2023-03-02 10:56:24
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
import { JsvWidgetWrapperGroup } from 'jsview/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js';
|
|
9
9
|
//考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
|
|
10
10
|
import * as BrowserJsvPlayer from "./JsvPlayer/JsvPlayerBrowser.vue";
|
|
11
|
+
import * as BrowserJsvAudio from "./JsvAudio/JsvAudioBrowser.vue";
|
|
11
12
|
|
|
12
13
|
JsvWidgetWrapperGroup.BrowserJsvPlayer = BrowserJsvPlayer;
|
|
14
|
+
JsvWidgetWrapperGroup.BrowserJsvAudio = BrowserJsvAudio;
|
|
13
15
|
|
|
14
16
|
console.log("load browser plugin widgets.");
|