@shijiu/jsview-vue 2.2.426-test.0 → 2.3.151-test.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.
- package/bin/browser/BrowserAudio.vue.mjs +4 -1
- package/bin/jsview-vue-common.mjs +1 -1
- package/bin/jsview-vue.mjs +9771 -7511
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +21 -1
- package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
- package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +8 -1
- package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +2 -1
- package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +10 -7
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
- package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
- package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
- package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
- package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
- package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
- package/bin/types/utils/JsViewVueTools/ForgeHandles.d.ts +1 -0
- package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +43 -1
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +3 -3
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +7 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +15 -2
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +2 -0
- package/bin/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
- package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
- package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
- package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
- package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
- package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +11 -0
- package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
- package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
- package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +2 -1
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
- package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
- package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
- package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
- package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +72 -0
- package/bin/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +26 -0
- package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
- package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +112 -0
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +142 -0
- package/bin/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +3 -1
- package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +4 -3
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
- package/bin/types/utils/JsViewVueWidget/index.d.ts +4 -1
- package/package.json +1 -1
- package/utils/JsViewEngineWidget/CheckType.js +3 -3
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +27 -1
- package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
- package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
- package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +97 -13
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +876 -412
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +43 -2
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +38 -26
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +144 -73
- package/utils/JsViewEngineWidget/WidgetCommon.ts +12 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +4 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue +13 -13
- package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
- package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
- package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +50 -32
- package/utils/JsViewVueTools/FeatureActive.ts +2 -1
- package/utils/JsViewVueTools/ForgeHandles.ts +5 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +109 -4
- package/utils/JsViewVueTools/JsvTextTools.ts +3 -1
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +15 -12
- package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +36 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +24 -3
- package/utils/JsViewVueTools/JsvTextureStore/Store.ts +33 -21
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +56 -41
- package/utils/JsViewVueTools/index.js +0 -1
- package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
- package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
- package/utils/JsViewVueWidget/JsvDashPath.vue +150 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +153 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
- package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +26 -22
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
- package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
- package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -2
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue +108 -0
- package/utils/JsViewVueWidget/JsvSoundPool.js +75 -12
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
- package/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue +543 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +3 -3
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue +644 -0
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +56 -50
- package/utils/JsViewVueWidget/index.js +4 -1
- package/bin/browser/BrowserApic.vue.mjs +0 -114
- package/bin/browser/BrowserApic2.vue.mjs +0 -108
- package/bin/browser/BrowserApicLib.mjs +0 -431
- package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
- package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
import { TextureBase } from "./Texture";
|
|
2
|
+
import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
|
|
2
3
|
|
|
3
4
|
class JsvTextureStore {
|
|
4
|
-
|
|
5
|
+
private textureMap: Map<String, TextureBase> = new Map();
|
|
6
|
+
private hasAutoRecycle: boolean = false;
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
constructor() { }
|
|
7
9
|
|
|
10
|
+
public addToStore(storeName: String, textureRef: TextureBase) {
|
|
11
|
+
if (!this.hasAutoRecycle && textureRef && textureRef.isAutoRecycle()) {
|
|
12
|
+
this.hasAutoRecycle = true;
|
|
13
|
+
ForgeHandles.sRenderBridge.AddWillSwapListener("jsv-texture-store", this.onWillSwap.bind(this));
|
|
8
14
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.error(`Error: name=${storeName} not in map`);
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
15
|
+
this.textureMap.set(storeName, textureRef);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public getFromStore(storeName: String): TextureBase | undefined {
|
|
19
|
+
return this.textureMap.get(storeName);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public removeFromStore(storeName: String): TextureBase | undefined {
|
|
23
|
+
if (this.textureMap.has(storeName)) {
|
|
24
|
+
let textureBaseRef = this.textureMap.get(storeName);
|
|
25
|
+
this.textureMap.delete(storeName);
|
|
26
|
+
return textureBaseRef;
|
|
27
|
+
} else {
|
|
28
|
+
console.error(`Error: name=${storeName} not in map`);
|
|
29
|
+
return undefined;
|
|
27
30
|
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private onWillSwap() {
|
|
34
|
+
this.textureMap.forEach((texture, key) => {
|
|
35
|
+
if (texture && texture.isAutoRecycle()) {
|
|
36
|
+
texture.tryRecycle();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
let sStore: JsvTextureStore = new JsvTextureStore();
|
|
31
43
|
|
|
32
|
-
export default sStore;
|
|
44
|
+
export default sStore;
|
|
@@ -1,53 +1,68 @@
|
|
|
1
1
|
import sStore from "./Store";
|
|
2
2
|
|
|
3
|
+
const AUTO_RECYCLE_DELAY = 3;
|
|
3
4
|
export class TextureBase {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (baseName) {
|
|
10
|
-
this.baseName = baseName;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
5
|
+
private baseName: String = "T";
|
|
6
|
+
protected textureRef: any = null; // Forge.ImageTexture
|
|
7
|
+
public storeName: String = "";
|
|
8
|
+
protected autoRecycle: boolean = false;
|
|
9
|
+
private autoRecycleDelay: number = AUTO_RECYCLE_DELAY;
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sStore.addToStore(this.storeName, this);
|
|
11
|
+
constructor(baseName: String | null) {
|
|
12
|
+
if (baseName) {
|
|
13
|
+
this.baseName = baseName;
|
|
18
14
|
}
|
|
15
|
+
}
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
tryRecycle() {
|
|
18
|
+
if (!this.autoRecycle) return;
|
|
19
|
+
this.autoRecycleDelay--;
|
|
20
|
+
if (this.autoRecycleDelay < 0) {
|
|
21
|
+
this.recycle();
|
|
22
22
|
}
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
* @return {String} BaseName-textureId 格式的名字,用于 jsvtexturestore:// 的访问链接
|
|
29
|
-
*/
|
|
30
|
-
public commit(): String {
|
|
31
|
-
// Should override by extends to create Forge.ImageTexture -> textureRef
|
|
32
|
-
return this.storeName;
|
|
33
|
-
}
|
|
25
|
+
isAutoRecycle() {
|
|
26
|
+
return this.autoRecycle;
|
|
27
|
+
}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
protected addToStore() {
|
|
30
|
+
this.storeName = this.getStoreName();
|
|
31
|
+
this.textureRef.DisableAutoRecycle(); // 被store管理的,取消自动清理
|
|
32
|
+
sStore.addToStore(this.storeName, this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected getStoreName() {
|
|
36
|
+
return `${this.baseName}-${this.textureRef?.GetTextureId()}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* commit
|
|
41
|
+
* 完成绘制设置,出发制作目标texture
|
|
42
|
+
*
|
|
43
|
+
* @return {String} BaseName-textureId 格式的名字,用于 jsvtexturestore:// 的访问链接
|
|
44
|
+
*/
|
|
45
|
+
public commit(): String {
|
|
46
|
+
// Should override by extends to create Forge.ImageTexture -> textureRef
|
|
47
|
+
return this.storeName;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* getTextureRef
|
|
52
|
+
* 内部接口,获取内联的Forge.ImageTexture的句柄
|
|
53
|
+
*
|
|
54
|
+
* @return {String} BaseName-textureId 格式的名字,用于 jsvtexturestore:// 的访问链接
|
|
55
|
+
*/
|
|
56
|
+
public getTextureRef(): any {
|
|
57
|
+
return this.textureRef;
|
|
58
|
+
}
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
60
|
+
public recycle() {
|
|
61
|
+
// 释放native端的texture实体
|
|
62
|
+
let textureRef = sStore.removeFromStore(this.storeName);
|
|
63
|
+
if (textureRef) {
|
|
64
|
+
// 释放native端的texture实体
|
|
65
|
+
this.textureRef?.RequestToUnload();
|
|
52
66
|
}
|
|
67
|
+
}
|
|
53
68
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* 【模块 export 内容】
|
|
5
|
+
* JsvDashPath:Vue组件,用于绘制虚线路径
|
|
6
|
+
* layout {Object}: (必填)组件位置,格式为 {left: number, top: number}
|
|
7
|
+
* points {Array}: (必填)点数组,每个点包含 x 和 y 坐标,坐标是相对于layout中指定的left和top
|
|
8
|
+
* 格式为 [{x: number, y: number}, ...]
|
|
9
|
+
* dash {Array}: 虚线配置数组,例如 [10, 5] 表示10px实线,5px空白,默认值 [10, 10]
|
|
10
|
+
* phase {Number}: 虚线起始位置偏移,默认值 0
|
|
11
|
+
* color {String}: 线条颜色,默认值 "#FFFFFF"
|
|
12
|
+
* lineWidth {Number}: 线条宽度,默认值 2
|
|
13
|
+
*
|
|
14
|
+
* 注意事项:
|
|
15
|
+
* 组件会根据传入的points自动计算所需画布大小
|
|
16
|
+
* 组件会在卸载时自动清理创建的纹理资源
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div
|
|
21
|
+
:style="{
|
|
22
|
+
left: layout.left,
|
|
23
|
+
top: layout.top,
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
:style="{
|
|
28
|
+
left: canvasInfo.minX,
|
|
29
|
+
top: canvasInfo.minY,
|
|
30
|
+
width: canvasInfo.width,
|
|
31
|
+
height: canvasInfo.height,
|
|
32
|
+
backgroundImage: `url(jsvtexturestore://${sourceId})`,
|
|
33
|
+
}"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup>
|
|
39
|
+
import { JsvTextureStoreApi } from "../JsViewVueTools";
|
|
40
|
+
import { onBeforeUnmount, computed } from "vue";
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
// 组件位置 {left: number, top: number}
|
|
44
|
+
layout: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
// 点数组,每个点包含 x 和 y 坐标, 坐标是相对与layout中指定的left和top
|
|
49
|
+
points: {
|
|
50
|
+
type: Array,
|
|
51
|
+
required: true,
|
|
52
|
+
validator: (value) => {
|
|
53
|
+
return value.every((point) => "x" in point && "y" in point);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
// 虚线配置,例如 [10, 5] 表示10px实线,5px空白
|
|
57
|
+
dash: {
|
|
58
|
+
type: Array,
|
|
59
|
+
default: () => [10, 10],
|
|
60
|
+
},
|
|
61
|
+
// 虚线起始位置偏移
|
|
62
|
+
phase: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0,
|
|
65
|
+
},
|
|
66
|
+
// 线条颜色
|
|
67
|
+
color: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "#FFFFFF",
|
|
70
|
+
},
|
|
71
|
+
// 线条宽度
|
|
72
|
+
lineWidth: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: 2,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// 计算坐标系调整值和画布尺寸
|
|
79
|
+
const canvasInfo = computed(() => {
|
|
80
|
+
const xValues = props.points.map((p) => p.x);
|
|
81
|
+
const yValues = props.points.map((p) => p.y);
|
|
82
|
+
|
|
83
|
+
// 找出最小坐标值
|
|
84
|
+
const minX = Math.min(...xValues);
|
|
85
|
+
const minY = Math.min(...yValues);
|
|
86
|
+
|
|
87
|
+
// 计算偏移量(考虑线宽)
|
|
88
|
+
const lineOffset = Math.ceil(props.lineWidth / 2);
|
|
89
|
+
|
|
90
|
+
// 计算画布尺寸(考虑线宽)
|
|
91
|
+
const width = Math.max(...xValues) - minX + props.lineWidth * 2;
|
|
92
|
+
const height = Math.max(...yValues) - minY + props.lineWidth * 2;
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
minX,
|
|
96
|
+
minY,
|
|
97
|
+
lineOffset,
|
|
98
|
+
width,
|
|
99
|
+
height,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// 创建画布纹理
|
|
104
|
+
let sourceId = "";
|
|
105
|
+
const canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
106
|
+
canvasInfo.value.width,
|
|
107
|
+
canvasInfo.value.height
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// 绘制透明背景
|
|
111
|
+
canvasRef.drawColor("rgba(0,0,0,0)");
|
|
112
|
+
|
|
113
|
+
// 创建自定义路径
|
|
114
|
+
const path = canvasRef.customPath();
|
|
115
|
+
|
|
116
|
+
// 移动到第一个调整后的点
|
|
117
|
+
if (props.points.length > 0) {
|
|
118
|
+
const firstPoint = props.points[0];
|
|
119
|
+
path.moveTo(
|
|
120
|
+
firstPoint.x - canvasInfo.value.minX + canvasInfo.value.lineOffset,
|
|
121
|
+
firstPoint.y - canvasInfo.value.minY + canvasInfo.value.lineOffset
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
// 连接后续的调整后的点
|
|
125
|
+
for (let i = 1; i < props.points.length; i++) {
|
|
126
|
+
const point = props.points[i];
|
|
127
|
+
path.lineTo(
|
|
128
|
+
point.x - canvasInfo.value.minX + canvasInfo.value.lineOffset,
|
|
129
|
+
point.y - canvasInfo.value.minY + canvasInfo.value.lineOffset
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
path.close();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 使用虚线样式绘制路径
|
|
136
|
+
path.strokeWithSetting({
|
|
137
|
+
lineWidth: props.lineWidth,
|
|
138
|
+
color: props.color,
|
|
139
|
+
dash: props.dash,
|
|
140
|
+
phase: props.phase,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// 提交纹理并获取sourceId
|
|
144
|
+
sourceId = canvasRef.commit();
|
|
145
|
+
|
|
146
|
+
// 组件卸载时清理纹理
|
|
147
|
+
onBeforeUnmount(() => {
|
|
148
|
+
JsvTextureStoreApi.deleteTexture(sourceId);
|
|
149
|
+
});
|
|
150
|
+
</script>
|
|
@@ -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,153 @@
|
|
|
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
|
+
<div data-jsv-vw-as-bound-anchor="true">
|
|
149
|
+
<slot />
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</jsv-screen-flex>
|
|
153
|
+
</template>
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* 副轴方向多行内容总体的对齐方式,例如主轴为行时,项目在每行中竖直方向的对齐
|
|
17
17
|
* 特别注意: 这些属性会引起位置对齐问题, 所以会自动去掉: "overflow:hidden"
|
|
18
18
|
* askSize: boolean 设置会跟进flex的尺寸变化,设置后可通过getWidth/getHeight拿到尺寸,但会降低性能
|
|
19
|
-
* onSized: Function
|
|
20
|
-
|
|
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生效时,获取元素的宽度
|