@ray-js/ipc-player-integration 0.0.49 → 0.0.50-beta.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/lib/ctx/ctx.composition.js +6 -1
- package/lib/ctx/ctx.js +11 -1
- package/lib/features/initPlayerWidgets/index.d.ts +8 -0
- package/lib/features/initPlayerWidgets/index.js +13 -0
- package/lib/i18n/index.d.ts +8 -0
- package/lib/i18n/strings.d.ts +4 -0
- package/lib/i18n/strings.js +4 -0
- package/lib/interface.d.ts +9 -1
- package/lib/ui/bottomLeftContent.js +23 -8
- package/lib/ui/constant.d.ts +10 -0
- package/lib/ui/constant.js +12 -1
- package/lib/ui/ui.js +78 -4
- package/lib/ui/ui.less +15 -0
- package/lib/utils/content/dpCode.d.ts +1 -0
- package/lib/utils/content/dpCode.js +5 -1
- package/lib/utils/storage/index.d.ts +2 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +18 -1
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.less +1 -1
- package/lib/widgets/zoomTurntable/constants.d.ts +92 -0
- package/lib/widgets/zoomTurntable/constants.js +148 -0
- package/lib/widgets/zoomTurntable/entryAnchor.d.ts +7 -0
- package/lib/widgets/zoomTurntable/entryAnchor.js +7 -0
- package/lib/widgets/zoomTurntable/index.d.ts +8 -0
- package/lib/widgets/zoomTurntable/index.js +8 -0
- package/lib/widgets/zoomTurntable/lensModel.d.ts +53 -0
- package/lib/widgets/zoomTurntable/lensModel.js +137 -0
- package/lib/widgets/zoomTurntable/lensModel.test.d.ts +1 -0
- package/lib/widgets/zoomTurntable/lensModel.test.js +336 -0
- package/lib/widgets/zoomTurntable/lensSkill.d.ts +89 -0
- package/lib/widgets/zoomTurntable/lensSkill.js +332 -0
- package/lib/widgets/zoomTurntable/measureVisible.d.ts +22 -0
- package/lib/widgets/zoomTurntable/measureVisible.js +76 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +10 -0
- package/lib/widgets/zoomTurntable/turntable/index.js +76 -0
- package/lib/widgets/zoomTurntable/turntable/index.less +11 -0
- package/lib/widgets/zoomTurntable/turntable/rjs/index.js +242 -0
- package/lib/widgets/zoomTurntable/turntable/rjs/index.json +3 -0
- package/lib/widgets/zoomTurntable/turntable/rjs/index.rjs +691 -0
- package/lib/widgets/zoomTurntable/turntable/rjs/index.tyml +7 -0
- package/lib/widgets/zoomTurntable/turntable/type.d.ts +95 -0
- package/lib/widgets/zoomTurntable/turntable/type.js +1 -0
- package/lib/widgets/zoomTurntable/useLensZoom.d.ts +37 -0
- package/lib/widgets/zoomTurntable/useLensZoom.js +418 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +17 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +228 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.less +11 -0
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.d.ts +21 -0
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +253 -0
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.less +51 -0
- package/lib/widgets/zoomTurntable/zoomTurntableTip.d.ts +16 -0
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +76 -0
- package/lib/widgets/zoomTurntable/zoomTurntableTip.less +56 -0
- package/package.json +3 -3
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/* eslint-disable vars-on-top, func-names, no-var, one-var
|
|
2
|
+
-- 小程序原生组件层(rjs Component 壳),运行在 render 线程的 ES5 环境,
|
|
3
|
+
沿用内嵌来源 ray-zoom-turntable 的写法,不套用主工程的 ES6+ 规则 */
|
|
4
|
+
import Render from './index.rjs';
|
|
5
|
+
var BASE_RX = 258;
|
|
6
|
+
var BASE_RY = 175.5;
|
|
7
|
+
|
|
8
|
+
// 仅作 props 缺省兜底,实际刻度由 zoom_skill 推导后传入
|
|
9
|
+
var DEFAULT_MARKS = [{
|
|
10
|
+
value: 1,
|
|
11
|
+
label: '1'
|
|
12
|
+
}, {
|
|
13
|
+
value: 3,
|
|
14
|
+
label: '3'
|
|
15
|
+
}, {
|
|
16
|
+
value: 6,
|
|
17
|
+
label: '6'
|
|
18
|
+
}];
|
|
19
|
+
function normalizeMarks(value) {
|
|
20
|
+
if (Array.isArray(value)) return value;
|
|
21
|
+
if (typeof value === 'string') {
|
|
22
|
+
try {
|
|
23
|
+
var parsed = JSON.parse(value);
|
|
24
|
+
return Array.isArray(parsed) ? parsed : DEFAULT_MARKS;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return DEFAULT_MARKS;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return DEFAULT_MARKS;
|
|
30
|
+
}
|
|
31
|
+
function normalizeTicks(value) {
|
|
32
|
+
if (Array.isArray(value)) return value;
|
|
33
|
+
if (typeof value === 'string') {
|
|
34
|
+
try {
|
|
35
|
+
var parsed = JSON.parse(value);
|
|
36
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
function normalizeStyleOptions(value) {
|
|
44
|
+
if (value && typeof value === 'object') return value;
|
|
45
|
+
if (typeof value === 'string') {
|
|
46
|
+
try {
|
|
47
|
+
var parsed = JSON.parse(value);
|
|
48
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
function styleNumber(styleOptions, name, fallback) {
|
|
56
|
+
var options = normalizeStyleOptions(styleOptions);
|
|
57
|
+
var value = options && options[name];
|
|
58
|
+
if (value == null) return fallback;
|
|
59
|
+
var parsed = Number(value);
|
|
60
|
+
return isNaN(parsed) ? fallback : parsed;
|
|
61
|
+
}
|
|
62
|
+
function computeCanvasViewport(props) {
|
|
63
|
+
var inputScale = props.scale != null ? Number(props.scale) : 1;
|
|
64
|
+
var orientation = props.orientation === 'right' ? 'right' : 'bottom';
|
|
65
|
+
var cropRatio = props.cropRatio != null ? Number(props.cropRatio) : 0.2;
|
|
66
|
+
if (cropRatio < 0) cropRatio = 0;
|
|
67
|
+
if (cropRatio > 1) cropRatio = 1;
|
|
68
|
+
// 与 renderer 的 hitPadding 保持一致,否则 canvas 的 DOM 尺寸与绘制尺寸会打架
|
|
69
|
+
var hitPaddingX = styleNumber(props.styleOptions, 'hitPaddingX', 0) * inputScale;
|
|
70
|
+
var hitPaddingY = styleNumber(props.styleOptions, 'hitPaddingY', 0) * inputScale;
|
|
71
|
+
var bottomSin = 2 * cropRatio - 1;
|
|
72
|
+
if (bottomSin < -1) bottomSin = -1;
|
|
73
|
+
if (bottomSin > 1) bottomSin = 1;
|
|
74
|
+
var cropWidthRatio = 1;
|
|
75
|
+
if (cropRatio < 0.5) {
|
|
76
|
+
cropWidthRatio = Math.sqrt(1 - bottomSin * bottomSin);
|
|
77
|
+
}
|
|
78
|
+
var contentScale = inputScale;
|
|
79
|
+
var cropHalfWidth = BASE_RX * contentScale * cropWidthRatio;
|
|
80
|
+
var canvasWidth = cropHalfWidth * 2 + hitPaddingX * 2;
|
|
81
|
+
var canvasHeight = BASE_RY * contentScale * 2 * cropRatio + hitPaddingY * 2;
|
|
82
|
+
return orientation === 'right' ? {
|
|
83
|
+
canvasWidth: canvasHeight,
|
|
84
|
+
canvasHeight: canvasWidth
|
|
85
|
+
} : {
|
|
86
|
+
canvasWidth: canvasWidth,
|
|
87
|
+
canvasHeight: canvasHeight
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
var DEFAULT_VIEWPORT = computeCanvasViewport({
|
|
91
|
+
scale: 1,
|
|
92
|
+
cropRatio: 0.2,
|
|
93
|
+
orientation: 'bottom'
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// eslint-disable-next-line no-undef
|
|
97
|
+
Component({
|
|
98
|
+
properties: {
|
|
99
|
+
canvasId: {
|
|
100
|
+
type: String
|
|
101
|
+
},
|
|
102
|
+
scale: {
|
|
103
|
+
type: Number,
|
|
104
|
+
value: 1
|
|
105
|
+
},
|
|
106
|
+
orientation: {
|
|
107
|
+
type: String,
|
|
108
|
+
value: 'bottom'
|
|
109
|
+
},
|
|
110
|
+
cropRatio: {
|
|
111
|
+
type: Number,
|
|
112
|
+
value: 0.2
|
|
113
|
+
},
|
|
114
|
+
min: {
|
|
115
|
+
type: Number,
|
|
116
|
+
value: 1
|
|
117
|
+
},
|
|
118
|
+
max: {
|
|
119
|
+
type: Number,
|
|
120
|
+
value: 6
|
|
121
|
+
},
|
|
122
|
+
step: {
|
|
123
|
+
type: Number,
|
|
124
|
+
value: 0.1
|
|
125
|
+
},
|
|
126
|
+
defaultValue: {
|
|
127
|
+
type: Number,
|
|
128
|
+
value: 1.0
|
|
129
|
+
},
|
|
130
|
+
value: {
|
|
131
|
+
type: Number,
|
|
132
|
+
optionalTypes: [Number]
|
|
133
|
+
},
|
|
134
|
+
marks: {
|
|
135
|
+
type: null,
|
|
136
|
+
value: DEFAULT_MARKS
|
|
137
|
+
},
|
|
138
|
+
ticks: {
|
|
139
|
+
type: null,
|
|
140
|
+
value: []
|
|
141
|
+
},
|
|
142
|
+
curve: {
|
|
143
|
+
type: null,
|
|
144
|
+
value: 1
|
|
145
|
+
},
|
|
146
|
+
activeColor: {
|
|
147
|
+
type: String,
|
|
148
|
+
value: '#FFFFFF'
|
|
149
|
+
},
|
|
150
|
+
styleOptions: {
|
|
151
|
+
type: null,
|
|
152
|
+
value: {}
|
|
153
|
+
},
|
|
154
|
+
onChange: {
|
|
155
|
+
type: Function
|
|
156
|
+
},
|
|
157
|
+
onChangeEnd: {
|
|
158
|
+
type: Function
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
data: {
|
|
162
|
+
canvasWidth: DEFAULT_VIEWPORT.canvasWidth,
|
|
163
|
+
canvasHeight: DEFAULT_VIEWPORT.canvasHeight
|
|
164
|
+
},
|
|
165
|
+
observers: {
|
|
166
|
+
value: function (newVal) {
|
|
167
|
+
if (this.render && this.render.setValue && newVal != null) {
|
|
168
|
+
this.render.setValue(newVal);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
'scale, orientation, cropRatio, min, max, step, marks, ticks, curve, activeColor, styleOptions': function () {
|
|
172
|
+
this.updateCanvasViewport();
|
|
173
|
+
if (this.render && this.render.updateOptions) {
|
|
174
|
+
this.render.updateOptions(this.getRendererOptions());
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
lifetimes: {
|
|
179
|
+
attached() {
|
|
180
|
+
this.render = new Render(this);
|
|
181
|
+
},
|
|
182
|
+
ready() {
|
|
183
|
+
var self = this;
|
|
184
|
+
setTimeout(function () {
|
|
185
|
+
self.updateCanvasViewport();
|
|
186
|
+
self.initCanvas();
|
|
187
|
+
}, 10);
|
|
188
|
+
},
|
|
189
|
+
detached() {
|
|
190
|
+
if (this.render) {
|
|
191
|
+
this.render.destroy();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
methods: {
|
|
196
|
+
updateCanvasViewport() {
|
|
197
|
+
var viewport = computeCanvasViewport(this.data);
|
|
198
|
+
if (Math.abs(viewport.canvasWidth - this.data.canvasWidth) > 0.01 || Math.abs(viewport.canvasHeight - this.data.canvasHeight) > 0.01) {
|
|
199
|
+
this.setData(viewport);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
getRendererOptions() {
|
|
203
|
+
var props = this.data;
|
|
204
|
+
return {
|
|
205
|
+
scale: props.scale,
|
|
206
|
+
orientation: props.orientation,
|
|
207
|
+
cropRatio: props.cropRatio,
|
|
208
|
+
min: props.min,
|
|
209
|
+
max: props.max,
|
|
210
|
+
step: props.step,
|
|
211
|
+
defaultValue: props.defaultValue,
|
|
212
|
+
marks: normalizeMarks(props.marks),
|
|
213
|
+
ticks: normalizeTicks(props.ticks),
|
|
214
|
+
curve: props.curve,
|
|
215
|
+
activeColor: props.activeColor,
|
|
216
|
+
styleOptions: normalizeStyleOptions(props.styleOptions)
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
initCanvas() {
|
|
220
|
+
var canvasId = this.data.canvasId || 'zoomTurntableCanvas';
|
|
221
|
+
var options = this.getRendererOptions();
|
|
222
|
+
// If controlled value is provided, use it as initial value
|
|
223
|
+
if (this.data.value != null) {
|
|
224
|
+
options.defaultValue = this.data.value;
|
|
225
|
+
}
|
|
226
|
+
this.render.init(canvasId, options);
|
|
227
|
+
},
|
|
228
|
+
onChange(value) {
|
|
229
|
+
this.triggerEvent('change', value);
|
|
230
|
+
},
|
|
231
|
+
onChangeEnd(value) {
|
|
232
|
+
this.triggerEvent('changeEnd', value);
|
|
233
|
+
},
|
|
234
|
+
// 转盘触摸开始 / 结束(含 touchcancel),逻辑层据此切换 ty.nativeDisabled
|
|
235
|
+
onTouchStart() {
|
|
236
|
+
this.triggerEvent('turntableTouchStart');
|
|
237
|
+
},
|
|
238
|
+
onTouchEnd() {
|
|
239
|
+
this.triggerEvent('turntableTouchEnd');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|