@shijiu/jsview-vue 1.9.888 → 1.9.921
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 +1 -1
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +36 -67
- package/utils/JsViewEngineWidget/TemplateParser.js +146 -138
- package/utils/JsViewEngineWidget/WidgetCommon.js +2 -11
- package/utils/JsViewPlugin/BrowserPluginLoader.js +14 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +1 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +1 -101
- package/utils/JsViewVueTools/JsvHashHistory.js +10 -10
- package/utils/JsViewVueTools/JsvImpactTracer.js +1 -1
- package/utils/JsViewVueTools/JsvStyleClass.js +1 -10
- package/utils/JsViewVueTools/JsvTextTools.js +7 -2
- package/utils/JsViewVueTools/TypeCheckAndSet.js +5 -5
- package/utils/JsViewVueTools/index.d.ts +1 -5
- package/utils/JsViewVueTools/index.js +0 -2
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +173 -152
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +88 -51
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +65 -63
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +45 -82
- package/utils/JsViewVueWidget/JsvFilterView.vue +12 -17
- package/utils/JsViewVueWidget/JsvGrid.vue +10 -2
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +7 -5
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +8 -60
- package/utils/JsViewVueWidget/JsvMarquee.vue +9 -12
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +30 -24
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +2 -2
- package/utils/JsViewVueWidget/JsvPosterImage.vue +4 -4
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +8 -8
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +4 -4
- package/utils/JsViewVueWidget/JsvScaleTextBox.vue +1 -1
- package/utils/JsViewVueWidget/JsvSoundPool.js +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -15
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +1 -1
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +115 -111
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +1 -1
- package/utils/JsViewVueWidget/JsvTextBox.vue +38 -16
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +16 -12
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +3 -3
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +0 -3
- package/utils/JsViewVueWidget/index.js +8 -13
- package/utils/JsViewVueWidget/utils/text.js +3 -4
|
@@ -1,164 +1,185 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, ref } from "vue";
|
|
2
3
|
import QRCode from "qr.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
value: String,
|
|
7
|
+
size: Number,
|
|
8
|
+
fgColor: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "#000000",
|
|
11
|
+
},
|
|
12
|
+
bgColor: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "#ffffff",
|
|
15
|
+
},
|
|
16
|
+
level: {
|
|
17
|
+
type: String, // ,容错级别,分别是L(7%)、M(15%)、Q(25%)、H(30%),
|
|
18
|
+
default: "L",
|
|
19
|
+
},
|
|
20
|
+
imageSettings: Object,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const convertStr = (str) => {
|
|
24
|
+
let out = "";
|
|
25
|
+
for (let i = 0; i < str.length; i++) {
|
|
26
|
+
let charcode = str.charCodeAt(i);
|
|
27
|
+
if (charcode < 0x0080) {
|
|
28
|
+
out += String.fromCharCode(charcode);
|
|
29
|
+
} else if (charcode < 0x0800) {
|
|
30
|
+
out += String.fromCharCode(0xc0 | (charcode >> 6));
|
|
31
|
+
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
32
|
+
} else if (charcode < 0xd800 || charcode >= 0xe000) {
|
|
33
|
+
out += String.fromCharCode(0xe0 | (charcode >> 12));
|
|
34
|
+
out += String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f));
|
|
35
|
+
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
36
|
+
} else {
|
|
37
|
+
// This is a surrogate pair, so we'll reconsitute the pieces and work
|
|
38
|
+
// from that
|
|
39
|
+
i++;
|
|
40
|
+
charcode =
|
|
41
|
+
0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));
|
|
42
|
+
out += String.fromCharCode(0xf0 | (charcode >> 18));
|
|
43
|
+
out += String.fromCharCode(0x80 | ((charcode >> 12) & 0x3f));
|
|
44
|
+
out += String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f));
|
|
45
|
+
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
};
|
|
50
|
+
const generatePath = (modules, margin = 0) => {
|
|
51
|
+
const ops = [];
|
|
52
|
+
modules.forEach((row, y) => {
|
|
53
|
+
let start = null;
|
|
54
|
+
row.forEach((cell, x) => {
|
|
55
|
+
if (!cell && start !== null) {
|
|
56
|
+
// M0 0h7v1H0z injects the space with the move and drops the comma,
|
|
57
|
+
// saving a char per operation
|
|
58
|
+
ops.push(
|
|
59
|
+
`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`
|
|
60
|
+
);
|
|
61
|
+
start = null;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// end of row, clean up or skip
|
|
66
|
+
if (x === row.length - 1) {
|
|
67
|
+
if (!cell) {
|
|
68
|
+
// We would have closed the op above already so this can only mean
|
|
69
|
+
// 2+ light modules in a row.
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (start === null) {
|
|
73
|
+
// Just a single dark module.
|
|
74
|
+
ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
|
|
75
|
+
} else {
|
|
76
|
+
// Otherwise finish the current line.
|
|
77
|
+
ops.push(
|
|
78
|
+
`M${start + margin},${y + margin} h${x + 1 - start}v1H${
|
|
79
|
+
start + margin
|
|
80
|
+
}z`
|
|
81
|
+
);
|
|
26
82
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.qrcodeRes = this.renderQrcode();
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
convertStr(str) {
|
|
33
|
-
let out = "";
|
|
34
|
-
for (let i = 0; i < str.length; i++) {
|
|
35
|
-
let charcode = str.charCodeAt(i);
|
|
36
|
-
if (charcode < 0x0080) {
|
|
37
|
-
out += String.fromCharCode(charcode);
|
|
38
|
-
} else if (charcode < 0x0800) {
|
|
39
|
-
out += String.fromCharCode(0xc0 | (charcode >> 6));
|
|
40
|
-
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
41
|
-
} else if (charcode < 0xd800 || charcode >= 0xe000) {
|
|
42
|
-
out += String.fromCharCode(0xe0 | (charcode >> 12));
|
|
43
|
-
out += String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f));
|
|
44
|
-
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
45
|
-
} else {
|
|
46
|
-
// This is a surrogate pair, so we'll reconsitute the pieces and work
|
|
47
|
-
// from that
|
|
48
|
-
i++;
|
|
49
|
-
charcode =
|
|
50
|
-
0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));
|
|
51
|
-
out += String.fromCharCode(0xf0 | (charcode >> 18));
|
|
52
|
-
out += String.fromCharCode(0x80 | ((charcode >> 12) & 0x3f));
|
|
53
|
-
out += String.fromCharCode(0x80 | ((charcode >> 6) & 0x3f));
|
|
54
|
-
out += String.fromCharCode(0x80 | (charcode & 0x3f));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return out;
|
|
58
|
-
},
|
|
59
|
-
generatePath(modules, margin = 0) {
|
|
60
|
-
const ops = [];
|
|
61
|
-
modules.forEach((row, y) => {
|
|
62
|
-
let start = null;
|
|
63
|
-
row.forEach((cell, x) => {
|
|
64
|
-
if (!cell && start !== null) {
|
|
65
|
-
// M0 0h7v1H0z injects the space with the move and drops the comma,
|
|
66
|
-
// saving a char per operation
|
|
67
|
-
ops.push(
|
|
68
|
-
`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`
|
|
69
|
-
);
|
|
70
|
-
start = null;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
86
|
+
if (cell && start === null) {
|
|
87
|
+
start = x;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
return ops.join("");
|
|
92
|
+
};
|
|
93
|
+
const getImageSettings = (props) => {
|
|
94
|
+
// const { imageSettings, size } = props;
|
|
95
|
+
const imageSettings = props.imageSettings;
|
|
96
|
+
const size = props.size;
|
|
97
|
+
if (!imageSettings) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const w = imageSettings.width;
|
|
101
|
+
const h = imageSettings.height;
|
|
102
|
+
const x = !imageSettings.x ? size / 2 - w / 2 : imageSettings.x;
|
|
103
|
+
const y = !imageSettings.y ? size / 2 - h / 2 : imageSettings.y;
|
|
94
104
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// const { imageSettings, size } = props;
|
|
104
|
-
const imageSettings = props.imageSettings;
|
|
105
|
-
const size = props.size;
|
|
106
|
-
if (!imageSettings) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
const w = imageSettings.width;
|
|
110
|
-
const h = imageSettings.height;
|
|
111
|
-
const x = !imageSettings.x ? size / 2 - w / 2 : imageSettings.x;
|
|
112
|
-
const y = !imageSettings.y ? size / 2 - h / 2 : imageSettings.y;
|
|
105
|
+
return { x, y, h, w };
|
|
106
|
+
};
|
|
107
|
+
const renderQrcode = () => {
|
|
108
|
+
const qrcode = QRCode(
|
|
109
|
+
convertStr(props.value),
|
|
110
|
+
{
|
|
111
|
+
errorCorrectLevel: QRCode.ErrorCorrectLevel[props.level]
|
|
112
|
+
});
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.convertStr(this.value),
|
|
119
|
-
{
|
|
120
|
-
errorCorrectLevel: QRCode.ErrorCorrectLevel[this.level]
|
|
121
|
-
});
|
|
114
|
+
const cells = qrcode.modules;
|
|
115
|
+
if (cells === null) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
122
118
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
const margin = 2;
|
|
120
|
+
const numCells = cells.length + margin * 2;
|
|
121
|
+
const propsData = {
|
|
122
|
+
value: props.value,
|
|
123
|
+
size: props.size,
|
|
124
|
+
level: props.level,
|
|
125
|
+
bgColor: props.bgColor,
|
|
126
|
+
fgColor: props.fgColor,
|
|
127
|
+
imageSettings: props.imageSettings,
|
|
128
|
+
};
|
|
129
|
+
const calculatedImageSettings = getImageSettings(propsData);
|
|
130
|
+
if (props.imageSettings) {
|
|
131
|
+
imageStyle = {
|
|
132
|
+
backgroundImage: `url(${props.imageSettings.src})`,
|
|
133
|
+
height: calculatedImageSettings.h,
|
|
134
|
+
width: calculatedImageSettings.w,
|
|
135
|
+
left: calculatedImageSettings.x + margin,
|
|
136
|
+
top: calculatedImageSettings.y + margin,
|
|
137
|
+
};
|
|
138
|
+
} else {
|
|
139
|
+
imageStyle = {};
|
|
140
|
+
}
|
|
141
|
+
const fgPath = generatePath(cells, margin);
|
|
142
|
+
return { numCells, fgPath };
|
|
143
|
+
};
|
|
127
144
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
const svgRoot = ref(null);
|
|
146
|
+
let imageStyle = null;
|
|
147
|
+
const qrcodeRes = renderQrcode();
|
|
148
|
+
|
|
149
|
+
onMounted(() => {
|
|
150
|
+
svgRoot.value.jsvGetProxyView().RegisterOnProxyReady(() => {
|
|
151
|
+
const root = svgRoot.value.jsvGetProxyView().HtmlGetElement();
|
|
152
|
+
const doc = window.originDocument;
|
|
153
|
+
const svg = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
154
|
+
svg.setAttribute("type", "qrcode");
|
|
155
|
+
svg.setAttribute("shapeRendering", "crispEdges");
|
|
156
|
+
svg.setAttribute("height", props.size);
|
|
157
|
+
svg.setAttribute("width", props.size);
|
|
158
|
+
svg.setAttribute(
|
|
159
|
+
"viewBox",
|
|
160
|
+
"0 0 " + qrcodeRes.numCells + " " + qrcodeRes.numCells
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const path1 = doc.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
164
|
+
path1.setAttribute("fill", props.bgColor);
|
|
165
|
+
path1.setAttribute(
|
|
166
|
+
"d",
|
|
167
|
+
"M0,0 h" + qrcodeRes.numCells + "v" + qrcodeRes.numCells + "H0z"
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const path2 = doc.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
171
|
+
path2.setAttribute("fill", props.fgColor);
|
|
172
|
+
path2.setAttribute("d", qrcodeRes.fgPath);
|
|
173
|
+
|
|
174
|
+
svg.appendChild(path1);
|
|
175
|
+
svg.appendChild(path2);
|
|
176
|
+
|
|
177
|
+
root.appendChild(svg);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
148
180
|
</script>
|
|
149
181
|
|
|
150
182
|
<template>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
:type="'qrcode'"
|
|
154
|
-
:shapeRendering="'crispEdges'"
|
|
155
|
-
:height="size"
|
|
156
|
-
:width="size"
|
|
157
|
-
:viewBox="'0 0 ' + qrcodeRes.numCells + ' ' + qrcodeRes.numCells"
|
|
158
|
-
>
|
|
159
|
-
<jsve-path :fill="bgColor" :d="'M0,0 h' + qrcodeRes.numCells + 'v' + qrcodeRes.numCells + 'H0z'" />
|
|
160
|
-
<jsve-path :fill="fgColor" :d="qrcodeRes.fgPath" />
|
|
161
|
-
</jsve-svg>
|
|
162
|
-
<div :style="imageStyle"></div>
|
|
163
|
-
</div>
|
|
183
|
+
<div ref="svgRoot" :style="{ width: 100, height: 100 }"></div>
|
|
184
|
+
<div :style="imageStyle"></div>
|
|
164
185
|
</template>
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-02-08 09:29:17
|
|
4
|
-
* @
|
|
5
|
-
* @LastEditTime: 2022-11-24 10:15:37
|
|
4
|
+
* @LastEditTime: 2023-02-21 10:51:22
|
|
6
5
|
* @Description: file content
|
|
7
6
|
-->
|
|
8
7
|
<script>
|
|
9
|
-
import { ref } from "vue";
|
|
10
|
-
import { getKeyFramesGroup } from "../../JsViewVueTools/JsvDynamicKeyFrames";
|
|
11
|
-
|
|
12
8
|
const DECORATE_BORDER_RADIUS = "BroderRaidus";
|
|
13
9
|
const DECORATE_NINEPATCH_ALPHA_MIX = "NinePatchAlphaMix";
|
|
14
|
-
|
|
15
10
|
const TexAlignAnchor = {
|
|
16
11
|
LEFT_TOP: 1,
|
|
17
12
|
CENTER_TOP: 2,
|
|
@@ -75,7 +70,7 @@ export default {
|
|
|
75
70
|
left: Number,
|
|
76
71
|
width: Number,
|
|
77
72
|
height: Number,
|
|
78
|
-
borderRadius: String,
|
|
73
|
+
borderRadius: [String, Number],
|
|
79
74
|
decorate: Object,
|
|
80
75
|
animation: String,
|
|
81
76
|
duration: Number,
|
|
@@ -102,17 +97,12 @@ export default {
|
|
|
102
97
|
type: Object,
|
|
103
98
|
},
|
|
104
99
|
},
|
|
105
|
-
setup() {
|
|
106
|
-
let styleShell = ref({})
|
|
107
|
-
// 此处异步import为了处理在fadoration中导致的两个js互相import而加载异常问题。
|
|
108
|
-
const load = async function () {
|
|
109
|
-
styleShell = getKeyFramesGroup();
|
|
110
|
-
}
|
|
111
|
-
load();
|
|
100
|
+
setup(props) {
|
|
112
101
|
return {
|
|
113
|
-
styleShell,
|
|
114
102
|
animName: "browser-texture-anim-" + TOKEN++,
|
|
115
103
|
animDiv: null,
|
|
104
|
+
clipDiv: null,
|
|
105
|
+
imgDiv: null,
|
|
116
106
|
watcherHandlerList: [],
|
|
117
107
|
};
|
|
118
108
|
},
|
|
@@ -163,13 +153,14 @@ export default {
|
|
|
163
153
|
},
|
|
164
154
|
maskStyle() {
|
|
165
155
|
if (this.borderRadius) {
|
|
156
|
+
const radiusObj = this._readRadius(this.borderRadius);
|
|
166
157
|
return {
|
|
167
158
|
left: this.left + "px",
|
|
168
159
|
top: this.top + "px",
|
|
169
|
-
borderRadius:
|
|
160
|
+
borderRadius: `${radiusObj.topLeft}px ${radiusObj.topRight}px ${radiusObj.bottomLeft}px ${radiusObj.bottomRight}px`,
|
|
170
161
|
width: this.width + "px",
|
|
171
162
|
height: this.height + "px",
|
|
172
|
-
overflow:
|
|
163
|
+
overflow: "hidden",
|
|
173
164
|
};
|
|
174
165
|
} else if (this.decorate) {
|
|
175
166
|
if (this.decorate.type == DECORATE_NINEPATCH_ALPHA_MIX) {
|
|
@@ -207,80 +198,126 @@ export default {
|
|
|
207
198
|
borderRadius: `${this.decorate.topLeft}px ${this.decorate.topRight}px ${this.decorate.bottomRight}px ${this.decorate.bottomLeft}`,
|
|
208
199
|
width: this.width + "px",
|
|
209
200
|
height: this.height + "px",
|
|
210
|
-
overflow:
|
|
201
|
+
overflow: "hidden",
|
|
211
202
|
};
|
|
212
203
|
}
|
|
213
|
-
}
|
|
214
|
-
|
|
204
|
+
} else {
|
|
205
|
+
return {
|
|
215
206
|
left: this.left + "px",
|
|
216
207
|
top: this.top + "px",
|
|
217
208
|
width: this.width + "px",
|
|
218
209
|
height: this.height + "px",
|
|
219
|
-
overflow:
|
|
210
|
+
overflow: "hidden",
|
|
220
211
|
};
|
|
212
|
+
}
|
|
221
213
|
},
|
|
222
214
|
},
|
|
223
215
|
methods: {
|
|
216
|
+
_readRadius(setting) {
|
|
217
|
+
if (typeof setting == "number") {
|
|
218
|
+
return {
|
|
219
|
+
type: DECORATE_BORDER_RADIUS,
|
|
220
|
+
topLeft: setting,
|
|
221
|
+
topRight: setting,
|
|
222
|
+
bottomRight: setting,
|
|
223
|
+
bottomLeft: setting,
|
|
224
|
+
};
|
|
225
|
+
} else if (typeof setting == "string" && setting.length > 0) {
|
|
226
|
+
const pattern = /\d+/g;
|
|
227
|
+
let match = setting.match(pattern);
|
|
228
|
+
if (match.length > 0) {
|
|
229
|
+
let top_left = match[0];
|
|
230
|
+
let top_right = match.length > 1 ? match[1] : top_left;
|
|
231
|
+
return {
|
|
232
|
+
type: DECORATE_BORDER_RADIUS,
|
|
233
|
+
topLeft: top_left,
|
|
234
|
+
topRight: top_right,
|
|
235
|
+
bottomRight: match.length > 2 ? match[2] : top_left,
|
|
236
|
+
bottomLeft: match.length > 3 ? match[3] : top_right,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
},
|
|
224
242
|
start() {
|
|
225
243
|
if (this.animDiv && this.animation) {
|
|
226
244
|
this.animDiv.style.animation = this.animSet;
|
|
227
245
|
}
|
|
228
246
|
},
|
|
247
|
+
|
|
248
|
+
insertKeyframe(animDefine) {
|
|
249
|
+
const index = document.styleSheets[0].cssRules.length;
|
|
250
|
+
document.styleSheets[0].insertRule(animDefine, index);
|
|
251
|
+
},
|
|
252
|
+
removeKeyframe(animName) {
|
|
253
|
+
const styleSheetRef = document.styleSheets[0];
|
|
254
|
+
const cssRulesRef = styleSheetRef.cssRules;
|
|
255
|
+
// 对CssRules进行删除操作,倒序轮询
|
|
256
|
+
for (let i = cssRulesRef.length - 1; i >= 0; i--) {
|
|
257
|
+
if (cssRulesRef[i].name === animName) {
|
|
258
|
+
styleSheetRef.deleteRule(i);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
229
263
|
},
|
|
230
264
|
mounted() {
|
|
231
265
|
if (this.animation) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
);
|
|
266
|
+
//此控件直接操作dom因此不走JsvDynamicKeyframes, 直接通过dom添加keyframes
|
|
267
|
+
this.insertKeyframe("@keyframes " + this.animName + " " + this.animation)
|
|
235
268
|
}
|
|
236
|
-
//绕过 jsview 对document 的 hook
|
|
237
|
-
const clipDiv = window.originDocument.createElement("div");
|
|
238
|
-
Object.assign(clipDiv.style, this.maskStyle);
|
|
239
269
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.
|
|
245
|
-
|
|
246
|
-
|
|
270
|
+
this.$refs.root.jsvGetProxyView().RegisterOnProxyReady(() => {
|
|
271
|
+
const root = this.$refs.root.jsvGetProxyView().HtmlGetElement();
|
|
272
|
+
//绕过 jsview 对document 的 hook
|
|
273
|
+
this.clipDiv = window.originDocument.createElement("div");
|
|
274
|
+
Object.assign(this.clipDiv.style, this.maskStyle);
|
|
275
|
+
|
|
276
|
+
const textureLayout = this.textureLayout;
|
|
277
|
+
this.animDiv = window.originDocument.createElement("div");
|
|
278
|
+
Object.assign(this.animDiv.style, textureLayout);
|
|
279
|
+
this.animDiv.onanimationend = () => {
|
|
280
|
+
this.animDiv.style.animation = null;
|
|
281
|
+
this.onAnimationEnd?.();
|
|
282
|
+
};
|
|
247
283
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
284
|
+
this.imgDiv = window.originDocument.createElement("div");
|
|
285
|
+
this.imgDiv.style.width = textureLayout.width;
|
|
286
|
+
this.imgDiv.style.height = textureLayout.height;
|
|
287
|
+
this.imgDiv.style.backgroundImage = `url(${this.src})`;
|
|
288
|
+
this.imgDiv.style.transform = this.transform;
|
|
289
|
+
this.imgDiv.style.transformOrigin = this.transformOrigin;
|
|
254
290
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
291
|
+
this.animDiv.appendChild(this.imgDiv);
|
|
292
|
+
this.clipDiv.appendChild(this.animDiv);
|
|
293
|
+
root.appendChild(this.clipDiv);
|
|
294
|
+
});
|
|
258
295
|
|
|
259
296
|
this.watcherHandlerList.push(
|
|
260
297
|
this.$watch("left", (newValue) => {
|
|
261
|
-
clipDiv.style.left = newValue + "px";
|
|
298
|
+
this.clipDiv.style.left = newValue + "px";
|
|
262
299
|
})
|
|
263
300
|
);
|
|
264
301
|
this.watcherHandlerList.push(
|
|
265
302
|
this.$watch("top", (newValue) => {
|
|
266
|
-
clipDiv.style.top = newValue + "px";
|
|
303
|
+
this.clipDiv.style.top = newValue + "px";
|
|
267
304
|
})
|
|
268
305
|
);
|
|
269
306
|
this.watcherHandlerList.push(
|
|
270
307
|
this.$watch("width", (newValue) => {
|
|
271
|
-
clipDiv.style.width = newValue + "px";
|
|
308
|
+
this.clipDiv.style.width = newValue + "px";
|
|
272
309
|
})
|
|
273
310
|
);
|
|
274
311
|
this.watcherHandlerList.push(
|
|
275
312
|
this.$watch("height", (newValue) => {
|
|
276
|
-
clipDiv.style.height = newValue + "px";
|
|
313
|
+
this.clipDiv.style.height = newValue + "px";
|
|
277
314
|
})
|
|
278
315
|
);
|
|
279
316
|
this.watcherHandlerList.push(
|
|
280
317
|
this.$watch("textureLayout", (newValue) => {
|
|
281
318
|
Object.assign(this.animDiv.style, newValue);
|
|
282
|
-
imgDiv.style.width = newValue.width;
|
|
283
|
-
imgDiv.style.height = newValue.height;
|
|
319
|
+
this.imgDiv.style.width = newValue.width;
|
|
320
|
+
this.imgDiv.style.height = newValue.height;
|
|
284
321
|
})
|
|
285
322
|
);
|
|
286
323
|
if (this.autoStart) {
|
|
@@ -290,7 +327,7 @@ export default {
|
|
|
290
327
|
}
|
|
291
328
|
},
|
|
292
329
|
beforeUnmount() {
|
|
293
|
-
this.
|
|
330
|
+
this.removeKeyframe(this.animName);
|
|
294
331
|
for (let handler of this.watcherHandlerList) {
|
|
295
332
|
handler?.();
|
|
296
333
|
}
|
|
@@ -301,4 +338,4 @@ export default {
|
|
|
301
338
|
|
|
302
339
|
<template>
|
|
303
340
|
<div ref="root"></div>
|
|
304
|
-
</template>
|
|
341
|
+
</template>
|