@shijiu/jsview-vue 2.2.426-test.0 → 2.3.0

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.
Files changed (86) hide show
  1. package/bin/jsview-vue-common.mjs +1 -1
  2. package/bin/jsview-vue.mjs +7506 -6980
  3. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
  4. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
  5. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
  10. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
  11. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
  12. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
  13. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
  14. package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  15. package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
  16. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
  17. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +6 -0
  18. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
  19. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +1 -1
  20. package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
  21. package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
  22. package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
  23. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
  24. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
  25. package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
  26. package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
  27. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
  28. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
  29. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
  30. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
  31. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
  32. package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
  33. package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
  34. package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
  35. package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
  36. package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
  37. package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
  38. package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
  39. package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
  40. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
  41. package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
  42. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +3 -2
  43. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
  44. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
  45. package/bin/types/utils/JsViewVueWidget/index.d.ts +2 -0
  46. package/package.json +1 -1
  47. package/utils/JsViewEngineWidget/CheckType.js +3 -3
  48. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
  49. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
  50. package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
  51. package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
  52. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
  53. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +62 -10
  54. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +205 -91
  55. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +30 -0
  56. package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
  57. package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
  58. package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
  59. package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +49 -31
  60. package/utils/JsViewVueTools/JsvRuntimeBridge.js +12 -3
  61. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
  62. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +1 -1
  63. package/utils/JsViewVueTools/index.js +0 -1
  64. package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
  65. package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
  66. package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
  67. package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
  68. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
  69. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +151 -0
  70. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
  71. package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
  72. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
  73. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
  74. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
  75. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
  76. package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
  77. package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
  78. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  79. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
  80. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +48 -48
  81. package/utils/JsViewVueWidget/index.js +2 -0
  82. package/bin/browser/BrowserApic.vue.mjs +0 -114
  83. package/bin/browser/BrowserApic2.vue.mjs +0 -108
  84. package/bin/browser/BrowserApicLib.mjs +0 -431
  85. package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
  86. package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
@@ -0,0 +1,82 @@
1
+ export class AckEventDefine {
2
+ // Category
3
+ static CATEGORY_JSC: number = 1;
4
+ static CATEGORY_VIEW: number = 2;
5
+ static CATEGORY_EXCEPTION: number = 3;
6
+
7
+ // Type of jsc
8
+ // Content lifeCycle: event格式:
9
+ // {
10
+ // "act": string类型,当前动作,
11
+ // JsContext重载启动时(reload动作,或者loadUrl动作, 以及closeView时): "reset"
12
+ // js启动过程事件: 按顺序
13
+ // "systemJsLoaded": 系统js加载完成
14
+ // "engineJsRead": Engine Js 完成下载
15
+ // "engineJsLoaded": Engine Js 完成eval
16
+ // "mainJsRead": Main Js 完成下载
17
+ // "mainJsLoaded": Main Js 完成 eval
18
+ // "appJsStart": 开始运行框架的主入口处理
19
+ // "contextId": int类型,发生事件对应的context id,当url切换或者reload时,contentId会发生变化
20
+ // }
21
+ static TYPE_JS_CONTEXT_LIFECYCLE: number = 1;
22
+
23
+ // Content permission: event格式:
24
+ // {
25
+ // "contextId": int类型,发生事件对应的context id,当url切换或者reload时,contentId会发生变化
26
+ // "authDone": int类型 是否完成校验, 0: 还未进行校验, 1: 已完成校验
27
+ // ================== 授权做完后的信息 ====================
28
+ // success(bool): 当次授权校验是否通过
29
+ // showAlert(bool): APP界面右下角展示未授权提示,满足下面条件之一时会展示
30
+ // 1. app运行的main.js是未进行签名(签名参考src/appConfig/中的描述)的,提示"npm start 调试模式"
31
+ // 2. 仅在在线授权服务器无法达到, 并且达到允许次数时生效(每日累计1次, 最多累计30天), 提示"抢先版内核"
32
+ // 3. 远程授权api返回结果为未授权时
33
+ // 4. 本地有授权文件,但授权文件不合法或者过期
34
+ // errorCount(int): 在线授权api访问失败(网络不通)的累计次数, api访问到并拿到结果后清0
35
+ // checkType(int): 授权的校验方式, 1: 调试模式, 2: 本地文件校验的方式, 3: 在线校验方式
36
+ // customDescribe: 授权的描述, 许可范围等描述
37
+ // errorCode: 授权失败的错误码
38
+ // -1: apk签名不匹配(仅离线校验时)
39
+ // -2: js的app name未登记
40
+ // -3: js的app签名和app name登记信息不匹配
41
+ // -4: permission.js文件过期
42
+ // -5: core版本不匹配
43
+ // -6: 分支名不匹配
44
+ // -7: 在线鉴权时未通过的统一错误码(后台详细错误码搭建中...)
45
+ // -8: 页面为npm start的调试模式(开发人员调试时才会出现此状态)
46
+ // -101: 本地permission.js文件格式错误
47
+ // -102: permission.js文件授权信息中core版本无法正确解析为数字错误
48
+ // -103: permission.js文件授权信息中的日期格式错误
49
+ // -105: 在线鉴权api请求失败错误
50
+ // playerMaxVer(int): 播放器授权的最高版本(0000 00000) 前4位为渠道号,后5位为版本号
51
+ // }
52
+ static TYPE_JS_CONTEXT_PERMISSION: number = 2;
53
+
54
+ // Type of view
55
+ // Shared view layout: event格式:
56
+ // {
57
+ // "x": int类型,对应view更新到了x位置,
58
+ // "y": int类型,对应view更新到了y位置,
59
+ // "width": int类型,对应view宽度更新后的值,
60
+ // "height": int类型,对应view高度更新后的值,
61
+ // "mat4": native指针类型, view的位置信息的matrix,
62
+ // "visible": int类型, view是否可见,(0:不可见, 1:可见)
63
+ // "order": int类型, 本NativeSharedView的相对图层
64
+ // "dw": int类型,Design map width,用于换算x,y,width,height
65
+ // }
66
+ static TYPE_SHARED_VIEW_LAYOUT: number = 1;
67
+
68
+ // app view aspect ratio change: event格式:
69
+ // {
70
+ // "width": int类型,横轴比例,对应"16/9"中的16,
71
+ // "height": int类型,纵轴比例,对应"16/9"中的9,
72
+ // }
73
+ static TYPE_APP_ASPECT_RATIO_CHANGE: number = 2;
74
+
75
+ // Type of exception
76
+ // Unhandled exit action: event格式:
77
+ // {
78
+ // "reason": string类型,触发离开动作的触发器,例如: "backKey",
79
+ // "comment": string类型, 当BackKey场景, 为"keyDown"和"keyUp"
80
+ // }
81
+ static TYPE_EXCEPTION_UNHANDLED_EXIT_ACTION: number = 1;
82
+ }
@@ -1,7 +1,9 @@
1
1
  <script>
2
2
  import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
3
+ import { AckEventDefine } from "./AckEventDefine.ts";
3
4
  import playerExMethods from "./JsvMediaBrowserInterface.js";
4
5
  import { shallowRef } from "vue";
6
+ import { JsvNativeSharedDiv } from "jsview";
5
7
 
6
8
  let logDebug = console.log;
7
9
 
@@ -276,14 +278,16 @@ export default {
276
278
  */
277
279
  corner: { type: Number, default: 0 },
278
280
  },
279
- components: {},
281
+ components: {
282
+ JsvNativeSharedDiv,
283
+ },
280
284
  watch: {
281
285
  active(newValue) {
282
- console.log("LudlDebug active newValue: " + newValue);
286
+ console.log("active newValue: " + newValue);
283
287
  if (this.video) {
284
288
  if (newValue) {
285
289
  this.registerEvent();
286
- this.video.setHoleID(this.holeId);
290
+ // this.video.setHoleID?.(this.holeId);
287
291
  this.holeStyle = {
288
292
  left: 0,
289
293
  top: 0,
@@ -332,8 +336,7 @@ export default {
332
336
  return {
333
337
  video: null,
334
338
  holeId: "",
335
- jsvMainView: shallowRef(null),
336
- innerViewId: shallowRef(-1),
339
+ positionAckFunc: null,
337
340
  };
338
341
  },
339
342
 
@@ -370,8 +373,35 @@ export default {
370
373
  if (!this.video) {
371
374
  // 创建PC版本的video标签
372
375
  this.video = window.originDocument.createElement("video");
376
+ this.video.style.position = "absolute";
377
+ this.video.style.zIndex = -100;
373
378
  this._extendsApi(this.video);
374
- this.video.style.borderRadius = this.corner + "px";
379
+
380
+ const appElement = window.originDocument.getElementById("app");
381
+ document.body.insertBefore(this.video, appElement);
382
+
383
+ // 跟踪视频显示位置
384
+ let _this = this;
385
+ this.positionAckFunc = (event_json) => {
386
+ // 跟踪JsvNativeShared的位置变化
387
+ let new_pos = JSON.parse(event_json);
388
+ this.video.style.left =
389
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.x) + "px";
390
+ this.video.style.top =
391
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.y) + "px";
392
+
393
+ this.video.style.width =
394
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.width) + "px";
395
+ this.video.style.height =
396
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.height) + "px";
397
+ };
398
+
399
+ window.JsvCoreApi.WasmExt.listenerToAckEvent(
400
+ AckEventDefine.CATEGORY_VIEW,
401
+ AckEventDefine.TYPE_SHARED_VIEW_LAYOUT,
402
+ this.holeId,
403
+ this.positionAckFunc
404
+ );
375
405
  } else {
376
406
  this.video.setRef();
377
407
  first_create = false;
@@ -421,24 +451,20 @@ export default {
421
451
  }
422
452
  }
423
453
 
424
- // 创建挂载的VideoView
425
- this.jsvMainView = new Forge.VideoView(this.video, null);
426
- this.innerViewId = Forge.sViewStore.add(
427
- new Forge.ViewInfo(this.jsvMainView)
428
- );
429
-
430
454
  this.onRef?.(this.video);
431
455
  }
432
456
  },
433
457
 
434
458
  unmounted() {
435
459
  if (this.video != null) {
436
- // 清理View管理缓存
437
- if (this.innerViewId !== -1) {
438
- Forge.sViewStore.remove(this.innerViewId);
439
- this.innerViewId = -1;
440
- this.jsvMainView = null;
460
+ // 清理video标签
461
+ document.body.removeChild(this.video);
462
+
463
+ // 解除NativeSharedDiv对应的位置监听
464
+ if (this.positionAckFunc != null) {
465
+ window.JsvCoreApi.WasmExt.recycleAckListener(this.positionAckFunc);
441
466
  }
467
+
442
468
  this.onRef?.(null);
443
469
  }
444
470
  },
@@ -495,23 +521,15 @@ export default {
495
521
  </script>
496
522
 
497
523
  <template>
498
- <div
524
+ <jsv-native-shared-div
499
525
  :style="{
500
526
  ...holeStyle,
501
- backgroundColor: 'rgba(0,0,0,1)',
502
- borderRadius: corner,
527
+ left: this.style.left,
528
+ top: this.style.top,
503
529
  }"
504
- >
505
- <div
506
- :style="{
507
- left: holeStyle.left,
508
- top: holeStyle.top,
509
- width: holeStyle.width,
510
- height: holeStyle.height,
511
- }"
512
- :data-jsv-vw-innerview="innerViewId"
513
- />
514
- </div>
530
+ :getId="getHoleId"
531
+ :corner="corner"
532
+ />
515
533
  </template>
516
534
 
517
535
  <style scoped></style>
@@ -14,9 +14,9 @@ function direct_call(name, ...args) {
14
14
  } else {
15
15
  let func = null;
16
16
  if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge[name] === "function") {
17
- func = window.jJsvRuntimeBridge[name];
17
+ func = window.jJsvRuntimeBridge[name].bind(window.jJsvRuntimeBridge);
18
18
  } else if (window.jContentShellJBridge && typeof window.jContentShellJBridge[name] === "function") {
19
- func = window.jContentShellJBridge[name];
19
+ func = window.jContentShellJBridge[name].bind(window.jContentShellJBridge);
20
20
  }
21
21
  direct_call_map[name] = func;
22
22
  if (func) {
@@ -600,6 +600,14 @@ function providerUpdate(uri, contentValue, selection, selectionArgs) {
600
600
  return direct_call("providerUpdate", uri, contentValue ? JSON.stringify(contentValue) : null, selection, selectionArgs ? JSON.stringify(selectionArgs) : null)
601
601
  }
602
602
 
603
+ /**
604
+ *
605
+ * @returns 设备开机时长
606
+ */
607
+ function getBootTime(){
608
+ return direct_call("getBootTime")
609
+ }
610
+
603
611
 
604
612
  // 显示声明,可以提高执行速度和利用上编辑器的成员名提示功能
605
613
  const bridge = {
@@ -645,7 +653,8 @@ const bridge = {
645
653
  providerQuery,
646
654
  providerInsert,
647
655
  providerDelete,
648
- providerUpdate
656
+ providerUpdate,
657
+ getBootTime
649
658
  };
650
659
 
651
660
  export {
@@ -1,5 +1,29 @@
1
1
  import * as Constants from "./CommandList"
2
2
 
3
+ /**
4
+ * PathStrokeSetting
5
+ * 描边样式设定
6
+ * lineWidth: 描边线宽
7
+ * color: 描边颜色
8
+ * dash: 描边虚线样式,例如[10, 5]表示10px实线,5px虚线,交替出现
9
+ * phase: 描边虚线样式起始位置,例如0表示从虚线开始位置开始绘制
10
+ */
11
+ interface PathStrokeSetting {
12
+ lineWidth: Number,
13
+ color: String,
14
+ dash?: Array<Number>,
15
+ phase?: Number
16
+ }
17
+
18
+ function pathStrokeSettingToJson(setting: PathStrokeSetting): Object {
19
+ return {
20
+ "lineWidth": setting.lineWidth,
21
+ "clr": setting.color,
22
+ "dash": setting.dash,
23
+ "phase": setting.phase
24
+ }
25
+ }
26
+
3
27
  class DrawingPath {
4
28
  protected drawCommandsRefs: Array<Object> = [];
5
29
  protected finishedDraw: boolean = false; // 控制stroke和fill只能调用一次
@@ -16,6 +40,19 @@ class DrawingPath {
16
40
  * @param {String} color 颜色设定,例如rgba(red:0~255, green:0~255, blue:0~255, alpla:0~1.0), 或则 #AARRGGBB
17
41
  */
18
42
  public stroke(lineWidth: Number, color: String) {
43
+ this.strokeWithSetting({
44
+ lineWidth: lineWidth,
45
+ color: color,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * strokeWithSetting
51
+ * 绘制边框,并设置描边样式
52
+ *
53
+ * @param {PathStrokeSetting} setting 描边样式设定
54
+ */
55
+ public strokeWithSetting(setting: PathStrokeSetting) {
19
56
  if (this.finishedDraw) {
20
57
  console.error("Error: path can only draw once");
21
58
  return;
@@ -24,8 +61,7 @@ class DrawingPath {
24
61
  this.drawCommandsRefs.push({
25
62
  "cmd": Constants.CMD_PREPARE_PAINT,
26
63
  "type": "stroke",
27
- "lineWidth": lineWidth,
28
- "clr": color
64
+ ...pathStrokeSettingToJson(setting)
29
65
  });
30
66
  this.onFinishDraw(); // 调用继承类的完成处理执行绘制
31
67
  this.finishedDraw = true;
@@ -38,7 +38,7 @@ let sTextureStoreApi = {
38
38
  * @param {String|null} baseName 可选, 访问名的前缀信息
39
39
  * @return {CanvasTexture}
40
40
  */
41
- canvasTexture: (width: Number, height: Number, baseName: String | null): CanvasTexture => {
41
+ canvasTexture: (width: Number, height: Number, baseName: String | null = null): CanvasTexture => {
42
42
  return new CanvasTexture(width, height, baseName);
43
43
  },
44
44
 
@@ -19,7 +19,6 @@ export * from "./JsvImpactTracer";
19
19
  export * from "./JsvTextTools";
20
20
  export * from "./JsvPreDownloader"
21
21
  export { default as DefaultKeyCodeMap } from "./DefaultKeyMap";
22
- export * from "./JsvDemoTester"
23
22
  export * from "./JsvPerformance"
24
23
  export * from "./JsvTextureStore/JsvTextureStore"
25
24
  export * from "./JsvTextureDefines"
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ /**
3
+ * @file
4
+ *
5
+ * 【模块 export 内容】
6
+ * JsvPosterDiv:Vue高阶组件,海报描画
7
+ * props说明:
8
+ * @prop {{x:number, y:number, z:number}} position 坐标信息,优先级高于style中的left, top
9
+ * @prop {Object} style {Object} 包含
10
+ * left/top/width/height
11
+ * border-radius
12
+ * backgroundImage/backgroundColor
13
+ * 的style设置
14
+ * @prop {boolean} enableAA 默认开启的。anti-alias(局部)算法,此算法会引起边缘2~3像素虚化
15
+ */
16
+ </script>
17
+
18
+ <script setup lang="ts">
19
+ import { watchEffect, withDefaults, defineProps, shallowRef } from "vue";
20
+
21
+ interface PositionType {
22
+ x: number;
23
+ y: number;
24
+ z: number;
25
+ }
26
+
27
+ const rProps = withDefaults(
28
+ defineProps<{
29
+ style: Object | null;
30
+ position: any; // PositionType
31
+ enableAA: boolean;
32
+ }>(),
33
+ {
34
+ style: null,
35
+ position: null,
36
+ enableAA: true,
37
+ }
38
+ );
39
+
40
+ let rPositionX = shallowRef(0);
41
+ let rPositionY = shallowRef(0);
42
+ let rPositionZ = shallowRef(0);
43
+
44
+ let rDivStyle = shallowRef({});
45
+ let rEnableAA = shallowRef("0");
46
+
47
+ watchEffect(() => {
48
+ if (rProps.style) {
49
+ let { left, top, ...others } = rProps.style as any;
50
+
51
+ rPositionX.value = left;
52
+ rPositionY.value = top;
53
+ rPositionZ.value = 0;
54
+
55
+ rDivStyle.value = others;
56
+ }
57
+ if (rProps.position) {
58
+ rPositionX.value = isNaN(rProps.position.x)
59
+ ? rPositionX.value
60
+ : rProps.position.x;
61
+ rPositionY.value = isNaN(rProps.position.y)
62
+ ? rPositionY.value
63
+ : rProps.position.y;
64
+ rPositionZ.value = isNaN(rProps.position.z)
65
+ ? rPositionZ.value
66
+ : rProps.position.z;
67
+ }
68
+ rEnableAA.value = rProps.enableAA ? "1" : "0";
69
+ });
70
+ </script>
71
+
72
+ <template>
73
+ <div
74
+ :style="{
75
+ left: rPositionX,
76
+ top: rPositionY,
77
+ ...rDivStyle,
78
+ }"
79
+ :data-jsv-img-enable-aa="rEnableAA"
80
+ v-bind="$attrs"
81
+ :data-jsv-vw-set-z="rPositionZ"
82
+ >
83
+ <slot></slot>
84
+ </div>
85
+ </template>
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ /**
3
+ * @file
4
+ *
5
+ * 【模块 export 内容】
6
+ * JsvPosterDiv:Vue高阶组件,海报描画
7
+ * props说明:
8
+ * @prop {Object} style 包含
9
+ left/top/width/height
10
+ 的style设置
11
+ * @prop {number} perspective 透视精神,默认1000,要求透视效果前后差距越大,此值约小,
12
+ 推荐档位
13
+ 透视效果非常明显的场景: 300
14
+ 透视效果适中的场景: 1000~2000
15
+ */
16
+ </script>
17
+
18
+ <script setup lang="ts">
19
+ import { withDefaults, defineProps } from "vue";
20
+
21
+ const rProps = withDefaults(
22
+ defineProps<{
23
+ style: { top: number; left: number; width: number; height: number };
24
+ perspective: number;
25
+ }>(),
26
+ {
27
+ style: {
28
+ top: 0,
29
+ left: 0,
30
+ width: 0,
31
+ height: 0,
32
+ } as any,
33
+ perspective: 1000,
34
+ }
35
+ );
36
+ </script>
37
+
38
+ <template>
39
+ <div
40
+ :style="{
41
+ left: rProps.style.left,
42
+ top: rProps.style.top,
43
+ width: rProps.style.width,
44
+ height: rProps.style.height,
45
+ perspective: rProps.perspective,
46
+ }"
47
+ >
48
+ <slot></slot>
49
+ </div>
50
+ </template>
@@ -7,11 +7,4 @@
7
7
  */
8
8
  //! 考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
9
9
  import * as JsvApic from "./JsvApic.vue";
10
- let _JsvApic;
11
- if (window.JsView) {
12
- _JsvApic = JsvApic.default;
13
- } else {
14
- const BrowserApic = await import("./BrowserApic.vue");
15
- _JsvApic = BrowserApic.default;
16
- }
17
- export default _JsvApic;
10
+ export default JsvApic.default;
@@ -7,11 +7,4 @@
7
7
  */
8
8
  //! 考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
9
9
  import * as JsvApic2 from "./JsvApic2.vue";
10
- let _JsvApic2;
11
- if (window.JsView) {
12
- _JsvApic2 = JsvApic2.default;
13
- } else {
14
- const BrowserApic2 = await import("./BrowserApic2.vue");
15
- _JsvApic2 = BrowserApic2.default;
16
- }
17
- export default _JsvApic2;
10
+ export default JsvApic2.default
@@ -27,7 +27,7 @@
27
27
  * alignSelf: auto|flex-start|flex-end|center|stretch 默认auto, 覆盖container的alignItems设置
28
28
  * 特别注意: 这些属性会引起位置对齐问题, 所以会自动去掉: "overflow:hidden"
29
29
  * askSize: boolean 设置会跟进flex的尺寸变化,设置后可通过getWidth/getHeight拿到尺寸,但会降低性能
30
- * onSized: Function 比askSize更进一步,可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸
30
+ * onSized: Function(width:number, height:number) 比askSize更进一步,可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸
31
31
  *
32
32
  * expose说明:
33
33
  * getWidth(): 当askSize或者onSize生效时,获取元素的宽度
@@ -0,0 +1,151 @@
1
+ <!--
2
+ * @file
3
+ *
4
+ * 【模块 export 内容】
5
+ * JsvFullscreenAdjust: 将给定的宽高区域(一般为主屏幕),放到屏幕中心,保持横纵比
6
+ * props说明:
7
+ * childWidth: number 主屏幕的宽
8
+ * childHeight: number 主屏幕的高
9
+ * onSized: Function(width:number, height:number)
10
+ 可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸
11
+ * background: {string} (选填)背景图案 可选值: 绝对路径url|url(相对路径url)|#FFFFFF|rbga(255,0,0,1.0)
12
+ *
13
+ * expose说明:
14
+ * getWidth(): onSize生效时,获取元素的宽度
15
+ * getHeight(): onSize生效时,获取元素的高度
16
+ *
17
+ -->
18
+ <script setup>
19
+ import { shallowRef, watchEffect } from "vue";
20
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
21
+ import JsvScreenFlex from "./JsvScreenFlex.vue";
22
+
23
+ const rProps = defineProps({
24
+ childWidth: {
25
+ type: Number,
26
+ default: 0,
27
+ },
28
+ childHeight: {
29
+ type: Number,
30
+ default: 0,
31
+ },
32
+ askSize: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ onSized: {
37
+ type: Function,
38
+ default: null,
39
+ },
40
+ background: {
41
+ type: String,
42
+ default: null,
43
+ },
44
+ });
45
+
46
+ // 此div的宽度是固定的全屏尺寸,在jsview体系下,全屏的宽度就是designMapWidth
47
+ const cDivMaxWidth = Forge.sRenderBridge.GetScreenInfo().designedWidth;
48
+
49
+ let rScreenFlexRef = shallowRef(null);
50
+ let rChildWidth = shallowRef(0);
51
+ let rChildHeight = shallowRef(0);
52
+ let rScaleSet = shallowRef(null);
53
+
54
+ let vGetScreenSize = false;
55
+ let vScreenWidth = 0;
56
+ let vScreenHeight = 0;
57
+
58
+ watchEffect(() => {
59
+ if (vGetScreenSize) {
60
+ // 响应child的width, height的变化设置
61
+ _ResizeContainer(
62
+ vScreenWidth,
63
+ vScreenHeight,
64
+ rProps.childWidth,
65
+ rProps.childHeight
66
+ );
67
+ }
68
+ });
69
+
70
+ let cOnSizeFunc = (width, height) => {
71
+ if (rProps.onSized) {
72
+ rProps.onSized(width, height);
73
+ }
74
+
75
+ vScreenWidth = width;
76
+ vScreenHeight = height;
77
+ _ResizeContainer(
78
+ vScreenWidth,
79
+ vScreenHeight,
80
+ rProps.childWidth,
81
+ rProps.childHeight
82
+ );
83
+ };
84
+
85
+ function _ResizeContainer(screenWidth, screenHeight, childWidth, childHeight) {
86
+ if (childWidth == 0 || childHeight == 0) {
87
+ console.error(`Error: size is 0 set w=${childWidth} h=${childHeight}`);
88
+ return;
89
+ }
90
+
91
+ if (childWidth > cDivMaxWidth) {
92
+ console.error(
93
+ `Error: over max-width max-with=${cDivMaxWidth} set width=${childWidth}`
94
+ );
95
+ return;
96
+ }
97
+
98
+ rChildWidth.value = childWidth;
99
+ rChildHeight.value = childHeight;
100
+
101
+ let scale = 1.0;
102
+ let requireHeight = Math.floor((childWidth * screenHeight) / screenWidth);
103
+ if (requireHeight < childHeight) {
104
+ // height展示不下,以height为主,保留3位小数
105
+ scale = Math.floor((requireHeight / childHeight) * 1000) / 1000;
106
+ } else {
107
+ // height能展示下,以width为主, scale不变
108
+ }
109
+ rScaleSet.value = `scale3d(${scale}, ${scale}, 1)`;
110
+ }
111
+
112
+ defineExpose({
113
+ // TODO: PC模拟环境中目前没有浏览器的类似ResizeObserver接口
114
+ // 可以监听到left/ top变化,所以先关闭Left / Top的获取
115
+ // getLeft: () => {
116
+ // return SizeX.value;
117
+ // },
118
+ // getTop: () => {
119
+ // return SizeY.value;
120
+ // },
121
+
122
+ getWidth: () => {
123
+ return rScreenFlexRef.value?.getWidth();
124
+ },
125
+ getHeight: () => {
126
+ return rScreenFlexRef.value?.getHeight();
127
+ },
128
+ });
129
+ </script>
130
+
131
+ <template>
132
+ <jsv-screen-flex
133
+ :style="{
134
+ flexDirection: 'row',
135
+ justifyContent: 'center',
136
+ alignItems: 'center',
137
+ }"
138
+ :onSized="cOnSizeFunc"
139
+ :background="rProps.background"
140
+ >
141
+ <div
142
+ :style="{
143
+ width: rProps.childWidth,
144
+ height: rProps.childHeight,
145
+ transform: rScaleSet,
146
+ }"
147
+ >
148
+ <slot />
149
+ </div>
150
+ </jsv-screen-flex>
151
+ </template>
@@ -16,8 +16,8 @@
16
16
  * 副轴方向多行内容总体的对齐方式,例如主轴为行时,项目在每行中竖直方向的对齐
17
17
  * 特别注意: 这些属性会引起位置对齐问题, 所以会自动去掉: "overflow:hidden"
18
18
  * askSize: boolean 设置会跟进flex的尺寸变化,设置后可通过getWidth/getHeight拿到尺寸,但会降低性能
19
- * onSized: Function 比askSize更进一步,可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸
20
- * background: {string} (选填)背景图案 可选值: 绝对路径url|url(相对路径url)|#FFFFFF|rbga(255,0,0,1.0)
19
+ * onSized: Function(width:number, height:number)
20
+ 比askSize更进一步,可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸* background: {string} (选填)背景图案 可选值: 绝对路径url|url(相对路径url)|#FFFFFF|rbga(255,0,0,1.0)
21
21
  *
22
22
  * expose说明:
23
23
  * getWidth(): 当askSize或者onSize生效时,获取元素的宽度
@@ -1,3 +1,4 @@
1
1
 
2
2
  export { default as JsvFlexDiv } from "./JsvFlexDiv.vue";
3
3
  export { default as JsvScreenFlex } from "./JsvScreenFlex.vue";
4
+ export { default as JsvFullScrAdjust } from "./JsvFullScrAdjust.vue";