@midscene/visualizer 1.5.2 → 1.5.3-beta-20260305031416.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/dist/es/component/blackboard/index.css +82 -4
- package/dist/es/component/blackboard/index.mjs +73 -301
- package/dist/es/component/player/index.css +144 -119
- package/dist/es/component/player/index.mjs +468 -830
- package/dist/es/component/player/remotion/StepScene.mjs +190 -0
- package/dist/es/component/player/remotion/derive-frame-state.mjs +207 -0
- package/dist/es/component/player/remotion/export-branded-video.mjs +210 -0
- package/dist/es/component/player/remotion/frame-calculator.mjs +149 -0
- package/dist/es/component/player/use-frame-player.mjs +88 -0
- package/dist/es/component/universal-playground/index.mjs +14 -1
- package/dist/es/hooks/usePlaygroundExecution.mjs +11 -7
- package/dist/es/index.mjs +2 -2
- package/dist/es/store/store.mjs +9 -0
- package/dist/es/utils/replay-scripts.mjs +78 -59
- package/dist/lib/component/blackboard/index.css +82 -4
- package/dist/lib/component/blackboard/index.js +73 -307
- package/dist/lib/component/player/index.css +144 -119
- package/dist/lib/component/player/index.js +466 -828
- package/dist/lib/component/player/remotion/StepScene.js +224 -0
- package/dist/lib/component/player/remotion/derive-frame-state.js +241 -0
- package/dist/lib/component/player/remotion/export-branded-video.js +244 -0
- package/dist/lib/component/player/remotion/frame-calculator.js +186 -0
- package/dist/lib/component/player/use-frame-player.js +122 -0
- package/dist/lib/component/universal-playground/index.js +14 -1
- package/dist/lib/hooks/usePlaygroundExecution.js +11 -7
- package/dist/lib/index.js +3 -0
- package/dist/lib/store/store.js +9 -0
- package/dist/lib/utils/replay-scripts.js +80 -58
- package/dist/types/component/blackboard/index.d.ts +0 -4
- package/dist/types/component/player/index.d.ts +0 -1
- package/dist/types/component/player/remotion/StepScene.d.ts +9 -0
- package/dist/types/component/player/remotion/derive-frame-state.d.ts +38 -0
- package/dist/types/component/player/remotion/export-branded-video.d.ts +2 -0
- package/dist/types/component/player/remotion/frame-calculator.d.ts +35 -0
- package/dist/types/component/player/use-frame-player.d.ts +17 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +15 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/store.d.ts +2 -0
- package/dist/types/utils/replay-scripts.d.ts +16 -1
- package/package.json +5 -8
- package/dist/es/utils/pixi-loader.mjs +0 -42
- package/dist/lib/utils/pixi-loader.js +0 -82
- package/dist/types/utils/pixi-loader.d.ts +0 -5
|
@@ -21,21 +21,99 @@
|
|
|
21
21
|
max-width: 500px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.blackboard-
|
|
25
|
-
|
|
24
|
+
.blackboard-main-content {
|
|
25
|
+
position: relative;
|
|
26
|
+
overflow: hidden;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
.blackboard-
|
|
29
|
+
.blackboard-screenshot {
|
|
29
30
|
box-sizing: border-box;
|
|
30
31
|
border: 1px solid #888;
|
|
31
32
|
width: 100%;
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.blackboard-overlay {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
width: 100%;
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.blackboard-rect {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
position: absolute;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.blackboard-rect-label {
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
padding: 1px 4px;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
line-height: 1.4;
|
|
56
|
+
position: absolute;
|
|
57
|
+
bottom: 100%;
|
|
58
|
+
left: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.blackboard-rect-search {
|
|
62
|
+
background: rgba(2, 131, 145, .4);
|
|
63
|
+
border: 1px solid #028391;
|
|
64
|
+
box-shadow: 4px 4px 2px rgba(51, 51, 51, .4);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.blackboard-rect-search .blackboard-rect-label {
|
|
68
|
+
color: #028391;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.blackboard-rect-highlight {
|
|
72
|
+
background: rgba(253, 89, 7, .4);
|
|
73
|
+
border: 1px solid #fd5907;
|
|
74
|
+
animation: 1.2s ease-in-out infinite blackboard-pulse;
|
|
75
|
+
box-shadow: 4px 4px 2px rgba(51, 51, 51, .4);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.blackboard-rect-highlight .blackboard-rect-label {
|
|
79
|
+
color: #000;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.blackboard-point {
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
background: rgba(253, 89, 7, .4);
|
|
85
|
+
border: 1px solid #fd5907;
|
|
86
|
+
border-radius: 50%;
|
|
87
|
+
width: 20px;
|
|
88
|
+
height: 20px;
|
|
89
|
+
margin-top: -10px;
|
|
90
|
+
margin-left: -10px;
|
|
91
|
+
animation: 1.2s ease-in-out infinite blackboard-pulse;
|
|
92
|
+
position: absolute;
|
|
93
|
+
box-shadow: 0 0 8px rgba(253, 89, 7, .5);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes blackboard-pulse {
|
|
97
|
+
0%, 100% {
|
|
98
|
+
opacity: .4;
|
|
99
|
+
box-shadow: 4px 4px 2px rgba(51, 51, 51, .4);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
50% {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
box-shadow: 4px 4px 2px rgba(51, 51, 51, .4), 0 0 16px rgba(253, 89, 7, .5);
|
|
105
|
+
}
|
|
32
106
|
}
|
|
33
107
|
|
|
34
108
|
[data-theme="dark"] .blackboard .footer, [data-theme="dark"] .blackboard .bottom-tip-item {
|
|
35
109
|
color: rgba(255, 255, 255, .45);
|
|
36
110
|
}
|
|
37
111
|
|
|
38
|
-
[data-theme="dark"] .blackboard-
|
|
112
|
+
[data-theme="dark"] .blackboard-screenshot {
|
|
39
113
|
border-color: rgba(255, 255, 255, .12);
|
|
40
114
|
}
|
|
41
115
|
|
|
116
|
+
[data-theme="dark"] .blackboard-rect-highlight .blackboard-rect-label {
|
|
117
|
+
color: #fff;
|
|
118
|
+
}
|
|
119
|
+
|
|
@@ -26,97 +26,14 @@ var __webpack_exports__ = {};
|
|
|
26
26
|
__webpack_require__.r(__webpack_exports__);
|
|
27
27
|
__webpack_require__.d(__webpack_exports__, {
|
|
28
28
|
Blackboard: ()=>Blackboard,
|
|
29
|
-
|
|
30
|
-
default: ()=>blackboard,
|
|
31
|
-
rectMarkForItem: ()=>rectMarkForItem
|
|
29
|
+
default: ()=>blackboard
|
|
32
30
|
});
|
|
33
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
-
require("pixi.js/unsafe-eval");
|
|
35
|
-
const external_pixi_js_namespaceObject = require("pixi.js");
|
|
36
32
|
const external_react_namespaceObject = require("react");
|
|
37
|
-
const color_js_namespaceObject = require("../../utils/color.js");
|
|
38
33
|
require("./index.css");
|
|
39
|
-
const external_pixi_filters_namespaceObject = require("pixi-filters");
|
|
40
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
41
|
-
try {
|
|
42
|
-
var info = gen[key](arg);
|
|
43
|
-
var value = info.value;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
reject(error);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (info.done) resolve(value);
|
|
49
|
-
else Promise.resolve(value).then(_next, _throw);
|
|
50
|
-
}
|
|
51
|
-
function _async_to_generator(fn) {
|
|
52
|
-
return function() {
|
|
53
|
-
var self = this, args = arguments;
|
|
54
|
-
return new Promise(function(resolve, reject) {
|
|
55
|
-
var gen = fn.apply(self, args);
|
|
56
|
-
function _next(value) {
|
|
57
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
58
|
-
}
|
|
59
|
-
function _throw(err) {
|
|
60
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
61
|
-
}
|
|
62
|
-
_next(void 0);
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const itemFillAlpha = 0.4;
|
|
67
|
-
const highlightAlpha = 0.4;
|
|
68
|
-
const pointRadius = 10;
|
|
69
|
-
const pointMarkForItem = (point, type)=>{
|
|
70
|
-
const [x, y] = point;
|
|
71
|
-
const themeColor = (0, color_js_namespaceObject.highlightColorForType)('element');
|
|
72
|
-
const graphics = new external_pixi_js_namespaceObject.Graphics();
|
|
73
|
-
graphics.beginFill(themeColor, itemFillAlpha);
|
|
74
|
-
graphics.drawCircle(x, y, pointRadius);
|
|
75
|
-
graphics.endFill();
|
|
76
|
-
return graphics;
|
|
77
|
-
};
|
|
78
|
-
const rectMarkForItem = (rect, name, type)=>{
|
|
79
|
-
const { left, top, width, height } = rect;
|
|
80
|
-
let themeColor;
|
|
81
|
-
themeColor = 'element' === type ? (0, color_js_namespaceObject.colorForName)(name) : 'searchArea' === type ? (0, color_js_namespaceObject.highlightColorForType)('searchArea') : (0, color_js_namespaceObject.highlightColorForType)('element');
|
|
82
|
-
const alpha = 'highlight' === type ? highlightAlpha : itemFillAlpha;
|
|
83
|
-
const graphics = new external_pixi_js_namespaceObject.Graphics();
|
|
84
|
-
graphics.beginFill(themeColor, alpha);
|
|
85
|
-
graphics.lineStyle(1, themeColor, 1);
|
|
86
|
-
graphics.drawRect(left, top, width, height);
|
|
87
|
-
graphics.endFill();
|
|
88
|
-
const dropShadowFilter = new external_pixi_filters_namespaceObject.DropShadowFilter({
|
|
89
|
-
blur: 2,
|
|
90
|
-
quality: 3,
|
|
91
|
-
alpha: 0.4,
|
|
92
|
-
offset: {
|
|
93
|
-
x: 4,
|
|
94
|
-
y: 4
|
|
95
|
-
},
|
|
96
|
-
color: 0x333333
|
|
97
|
-
});
|
|
98
|
-
graphics.filters = [
|
|
99
|
-
dropShadowFilter
|
|
100
|
-
];
|
|
101
|
-
const nameFontSize = 18;
|
|
102
|
-
if (!name) return [
|
|
103
|
-
graphics
|
|
104
|
-
];
|
|
105
|
-
const texts = new external_pixi_js_namespaceObject.Text(name, {
|
|
106
|
-
fontSize: nameFontSize,
|
|
107
|
-
fill: 0x0
|
|
108
|
-
});
|
|
109
|
-
texts.x = left;
|
|
110
|
-
texts.y = Math.max(top - (nameFontSize + 4), 0);
|
|
111
|
-
return [
|
|
112
|
-
graphics,
|
|
113
|
-
texts
|
|
114
|
-
];
|
|
115
|
-
};
|
|
116
34
|
const Blackboard = (props)=>{
|
|
117
35
|
var _props_uiContext;
|
|
118
36
|
const highlightElements = props.highlightElements || [];
|
|
119
|
-
highlightElements.map((e)=>e.id);
|
|
120
37
|
const highlightRect = props.highlightRect;
|
|
121
38
|
const highlightPoints = props.highlightPoints;
|
|
122
39
|
if (!(null == (_props_uiContext = props.uiContext) ? void 0 : _props_uiContext.shotSize)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
@@ -131,6 +48,8 @@ const Blackboard = (props)=>{
|
|
|
131
48
|
});
|
|
132
49
|
const context = props.uiContext;
|
|
133
50
|
const { shotSize, screenshot } = context;
|
|
51
|
+
const screenWidth = shotSize.width;
|
|
52
|
+
const screenHeight = shotSize.height;
|
|
134
53
|
const screenshotBase64 = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
135
54
|
if (!screenshot) return '';
|
|
136
55
|
if ('object' == typeof screenshot && 'base64' in screenshot) return screenshot.base64;
|
|
@@ -139,221 +58,20 @@ const Blackboard = (props)=>{
|
|
|
139
58
|
}, [
|
|
140
59
|
screenshot
|
|
141
60
|
]);
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
157
|
-
Promise.resolve((()=>_async_to_generator(function*() {
|
|
158
|
-
if (!domRef.current || !screenWidth) return;
|
|
159
|
-
yield app.init({
|
|
160
|
-
width: screenWidth,
|
|
161
|
-
height: screenHeight,
|
|
162
|
-
background: 0xffffff
|
|
163
|
-
});
|
|
164
|
-
const canvasEl = domRef.current;
|
|
165
|
-
domRef.current.appendChild(app.canvas);
|
|
166
|
-
const { clientWidth } = domRef.current.parentElement;
|
|
167
|
-
const targetHeight = 0.6 * window.innerHeight;
|
|
168
|
-
const viewportRatio = clientWidth / targetHeight;
|
|
169
|
-
if (screenWidth / screenHeight <= viewportRatio) {
|
|
170
|
-
const ratio = targetHeight / screenHeight;
|
|
171
|
-
canvasEl.style.width = `${Math.floor(screenWidth * ratio)}px`;
|
|
172
|
-
canvasEl.style.height = `${Math.floor(screenHeight * ratio)}px`;
|
|
173
|
-
}
|
|
174
|
-
app.stage.addChild(highlightContainer);
|
|
175
|
-
app.stage.addChild(elementMarkContainer);
|
|
176
|
-
setAppInitialed(true);
|
|
177
|
-
})())());
|
|
178
|
-
return ()=>{
|
|
179
|
-
console.log('will destroy');
|
|
180
|
-
if (null !== animationFrameRef.current) {
|
|
181
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
182
|
-
animationFrameRef.current = null;
|
|
183
|
-
}
|
|
184
|
-
try {
|
|
185
|
-
app.destroy(true, {
|
|
186
|
-
children: true,
|
|
187
|
-
texture: true
|
|
188
|
-
});
|
|
189
|
-
} catch (e) {
|
|
190
|
-
console.warn('destroy failed', e);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}, [
|
|
194
|
-
app,
|
|
195
|
-
screenWidth,
|
|
196
|
-
screenHeight
|
|
197
|
-
]);
|
|
198
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
199
|
-
if (!appInitialed) return;
|
|
200
|
-
app.stage.eventMode = 'static';
|
|
201
|
-
app.stage.hitArea = new external_pixi_js_namespaceObject.Rectangle(0, 0, screenWidth, screenHeight);
|
|
202
|
-
const clickHandler = (event)=>{
|
|
203
|
-
var _props_onCanvasClick;
|
|
204
|
-
console.log('pixi click', event);
|
|
205
|
-
const { x, y } = event.data.global;
|
|
206
|
-
null == (_props_onCanvasClick = props.onCanvasClick) || _props_onCanvasClick.call(props, [
|
|
207
|
-
Math.round(x),
|
|
208
|
-
Math.round(y)
|
|
209
|
-
]);
|
|
210
|
-
};
|
|
211
|
-
app.stage.on('click', clickHandler);
|
|
212
|
-
return ()=>{
|
|
213
|
-
var _app_stage;
|
|
214
|
-
null == app || null == (_app_stage = app.stage) || _app_stage.off('click');
|
|
215
|
-
};
|
|
216
|
-
}, [
|
|
217
|
-
appInitialed,
|
|
218
|
-
props.onCanvasClick,
|
|
219
|
-
screenWidth,
|
|
220
|
-
screenHeight
|
|
221
|
-
]);
|
|
222
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
223
|
-
if (!appInitialed) return;
|
|
224
|
-
const img = new Image();
|
|
225
|
-
img.onload = ()=>{
|
|
226
|
-
if (!app.stage) return;
|
|
227
|
-
const screenshotTexture = external_pixi_js_namespaceObject.Texture.from(img);
|
|
228
|
-
const backgroundSprite = new external_pixi_js_namespaceObject.Sprite(screenshotTexture);
|
|
229
|
-
backgroundSprite.x = 0;
|
|
230
|
-
backgroundSprite.y = 0;
|
|
231
|
-
backgroundSprite.width = screenWidth;
|
|
232
|
-
backgroundSprite.height = screenHeight;
|
|
233
|
-
backgroundSprite.eventMode = 'passive';
|
|
234
|
-
app.stage.addChildAt(backgroundSprite, 0);
|
|
235
|
-
pixiBgRef.current = backgroundSprite;
|
|
236
|
-
backgroundSprite.visible = backgroundVisible;
|
|
237
|
-
};
|
|
238
|
-
img.onerror = (e)=>{
|
|
239
|
-
console.error('load screenshot failed', e);
|
|
240
|
-
};
|
|
241
|
-
if (screenshotBase64) img.src = screenshotBase64;
|
|
242
|
-
else console.error('screenshotBase64 is empty, cannot load image');
|
|
243
|
-
}, [
|
|
244
|
-
app.stage,
|
|
245
|
-
appInitialed,
|
|
246
|
-
screenWidth,
|
|
247
|
-
screenHeight,
|
|
248
|
-
screenshotBase64
|
|
249
|
-
]);
|
|
250
|
-
const { highlightElementRects } = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
251
|
-
const highlightElementRects = [];
|
|
252
|
-
highlightContainer.removeChildren();
|
|
253
|
-
elementMarkContainer.removeChildren();
|
|
254
|
-
highlightContainer.eventMode = 'passive';
|
|
255
|
-
elementMarkContainer.eventMode = 'passive';
|
|
256
|
-
highlightGraphicsRef.current = [];
|
|
257
|
-
glowFiltersRef.current = [];
|
|
258
|
-
if (highlightRect) {
|
|
259
|
-
const [graphics] = rectMarkForItem(highlightRect, 'Search Area', 'searchArea');
|
|
260
|
-
highlightContainer.addChild(graphics);
|
|
261
|
-
}
|
|
262
|
-
if (highlightElements.length) highlightElements.forEach((element)=>{
|
|
263
|
-
const { rect, content, id } = element;
|
|
264
|
-
const items = rectMarkForItem(rect, content, 'highlight');
|
|
265
|
-
const graphics = items[0];
|
|
266
|
-
const glowFilter = new external_pixi_filters_namespaceObject.GlowFilter({
|
|
267
|
-
distance: 30,
|
|
268
|
-
outerStrength: 3,
|
|
269
|
-
innerStrength: 0,
|
|
270
|
-
color: 0xfd5907,
|
|
271
|
-
quality: 0.5
|
|
272
|
-
});
|
|
273
|
-
const existingFilters = graphics.filters;
|
|
274
|
-
if (Array.isArray(existingFilters)) graphics.filters = [
|
|
275
|
-
...existingFilters,
|
|
276
|
-
glowFilter
|
|
277
|
-
];
|
|
278
|
-
else if (existingFilters) graphics.filters = [
|
|
279
|
-
existingFilters,
|
|
280
|
-
glowFilter
|
|
281
|
-
];
|
|
282
|
-
else graphics.filters = [
|
|
283
|
-
glowFilter
|
|
284
|
-
];
|
|
285
|
-
items.forEach((item)=>highlightContainer.addChild(item));
|
|
286
|
-
highlightGraphicsRef.current.push(graphics);
|
|
287
|
-
glowFiltersRef.current.push(glowFilter);
|
|
288
|
-
});
|
|
289
|
-
if (null == highlightPoints ? void 0 : highlightPoints.length) highlightPoints.forEach((point)=>{
|
|
290
|
-
const graphics = pointMarkForItem(point, 'highlightPoint');
|
|
291
|
-
const glowFilter = new external_pixi_filters_namespaceObject.GlowFilter({
|
|
292
|
-
distance: 25,
|
|
293
|
-
outerStrength: 2.5,
|
|
294
|
-
innerStrength: 0,
|
|
295
|
-
color: 0xfd5907,
|
|
296
|
-
quality: 0.5
|
|
297
|
-
});
|
|
298
|
-
graphics.filters = [
|
|
299
|
-
glowFilter
|
|
300
|
-
];
|
|
301
|
-
highlightContainer.addChild(graphics);
|
|
302
|
-
highlightGraphicsRef.current.push(graphics);
|
|
303
|
-
glowFiltersRef.current.push(glowFilter);
|
|
304
|
-
});
|
|
305
|
-
elementMarkContainer.visible = elementsVisible;
|
|
306
|
-
return {
|
|
307
|
-
highlightElementRects
|
|
308
|
-
};
|
|
309
|
-
}, [
|
|
310
|
-
app,
|
|
311
|
-
appInitialed,
|
|
312
|
-
highlightElements,
|
|
313
|
-
hoverElement,
|
|
314
|
-
highlightRect,
|
|
315
|
-
highlightPoints
|
|
316
|
-
]);
|
|
317
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
318
|
-
if (!appInitialed || 0 === highlightGraphicsRef.current.length) return void console.log('Animation skipped:', {
|
|
319
|
-
appInitialed,
|
|
320
|
-
graphicsCount: highlightGraphicsRef.current.length
|
|
321
|
-
});
|
|
322
|
-
console.log('Starting pulsing animation for', highlightGraphicsRef.current.length, 'graphics');
|
|
323
|
-
const graphicsToAnimate = highlightGraphicsRef.current;
|
|
324
|
-
const glowFilters = glowFiltersRef.current;
|
|
325
|
-
const pulseDuration = 1200;
|
|
326
|
-
const minAlpha = 0.4;
|
|
327
|
-
const maxAlpha = 1.0;
|
|
328
|
-
const minGlowStrength = 2.0;
|
|
329
|
-
const maxGlowStrength = 5.0;
|
|
330
|
-
const startTime = performance.now();
|
|
331
|
-
const animate = ()=>{
|
|
332
|
-
const elapsed = performance.now() - startTime;
|
|
333
|
-
const progress = elapsed % pulseDuration / pulseDuration;
|
|
334
|
-
const sineValue = Math.sin(progress * Math.PI * 2);
|
|
335
|
-
const normalizedSine = (sineValue + 1) / 2;
|
|
336
|
-
const alpha = minAlpha + normalizedSine * (maxAlpha - minAlpha);
|
|
337
|
-
const glowStrength = minGlowStrength + normalizedSine * (maxGlowStrength - minGlowStrength);
|
|
338
|
-
graphicsToAnimate.forEach((graphics, index)=>{
|
|
339
|
-
graphics.alpha = alpha;
|
|
340
|
-
if (glowFilters[index]) glowFilters[index].outerStrength = glowStrength;
|
|
341
|
-
});
|
|
342
|
-
animationFrameRef.current = requestAnimationFrame(animate);
|
|
343
|
-
};
|
|
344
|
-
animate();
|
|
345
|
-
return ()=>{
|
|
346
|
-
console.log('Stopping pulsing animation');
|
|
347
|
-
if (null !== animationFrameRef.current) {
|
|
348
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
349
|
-
animationFrameRef.current = null;
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
}, [
|
|
353
|
-
appInitialed,
|
|
354
|
-
highlightElements,
|
|
355
|
-
highlightPoints
|
|
356
|
-
]);
|
|
61
|
+
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
62
|
+
const handleClick = (e)=>{
|
|
63
|
+
if (!props.onCanvasClick || !containerRef.current) return;
|
|
64
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
65
|
+
const scaleX = screenWidth / rect.width;
|
|
66
|
+
const scaleY = screenHeight / rect.height;
|
|
67
|
+
const x = Math.round((e.clientX - rect.left) * scaleX);
|
|
68
|
+
const y = Math.round((e.clientY - rect.top) * scaleY);
|
|
69
|
+
props.onCanvasClick([
|
|
70
|
+
x,
|
|
71
|
+
y
|
|
72
|
+
]);
|
|
73
|
+
};
|
|
74
|
+
const highlightElementRects = highlightElements.map((e)=>e.rect);
|
|
357
75
|
let bottomTipA = null;
|
|
358
76
|
if (1 === highlightElementRects.length) bottomTipA = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
359
77
|
className: "bottom-tip",
|
|
@@ -378,12 +96,64 @@ const Blackboard = (props)=>{
|
|
|
378
96
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
379
97
|
className: "blackboard",
|
|
380
98
|
children: [
|
|
381
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
99
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
382
100
|
className: "blackboard-main-content",
|
|
101
|
+
ref: containerRef,
|
|
102
|
+
onClick: handleClick,
|
|
383
103
|
style: {
|
|
384
|
-
width: '100%'
|
|
104
|
+
width: '100%',
|
|
105
|
+
position: 'relative',
|
|
106
|
+
cursor: props.onCanvasClick ? 'crosshair' : void 0
|
|
385
107
|
},
|
|
386
|
-
|
|
108
|
+
children: [
|
|
109
|
+
screenshotBase64 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
110
|
+
src: screenshotBase64,
|
|
111
|
+
alt: "screenshot",
|
|
112
|
+
className: "blackboard-screenshot",
|
|
113
|
+
draggable: false
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
116
|
+
className: "blackboard-overlay",
|
|
117
|
+
style: {
|
|
118
|
+
aspectRatio: `${screenWidth}/${screenHeight}`
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
highlightRect && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
122
|
+
className: "blackboard-rect blackboard-rect-search",
|
|
123
|
+
style: {
|
|
124
|
+
left: `${highlightRect.left / screenWidth * 100}%`,
|
|
125
|
+
top: `${highlightRect.top / screenHeight * 100}%`,
|
|
126
|
+
width: `${highlightRect.width / screenWidth * 100}%`,
|
|
127
|
+
height: `${highlightRect.height / screenHeight * 100}%`
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
130
|
+
className: "blackboard-rect-label",
|
|
131
|
+
children: "Search Area"
|
|
132
|
+
})
|
|
133
|
+
}),
|
|
134
|
+
highlightElements.map((el, idx)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
135
|
+
className: "blackboard-rect blackboard-rect-highlight",
|
|
136
|
+
style: {
|
|
137
|
+
left: `${el.rect.left / screenWidth * 100}%`,
|
|
138
|
+
top: `${el.rect.top / screenHeight * 100}%`,
|
|
139
|
+
width: `${el.rect.width / screenWidth * 100}%`,
|
|
140
|
+
height: `${el.rect.height / screenHeight * 100}%`
|
|
141
|
+
},
|
|
142
|
+
children: el.content && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
143
|
+
className: "blackboard-rect-label",
|
|
144
|
+
children: el.content
|
|
145
|
+
})
|
|
146
|
+
}, el.id || idx)),
|
|
147
|
+
null == highlightPoints ? void 0 : highlightPoints.map((point, idx)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
148
|
+
className: "blackboard-point",
|
|
149
|
+
style: {
|
|
150
|
+
left: `${point[0] / screenWidth * 100}%`,
|
|
151
|
+
top: `${point[1] / screenHeight * 100}%`
|
|
152
|
+
}
|
|
153
|
+
}, idx))
|
|
154
|
+
]
|
|
155
|
+
})
|
|
156
|
+
]
|
|
387
157
|
}),
|
|
388
158
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
389
159
|
className: "bottom-tip",
|
|
@@ -398,13 +168,9 @@ const Blackboard = (props)=>{
|
|
|
398
168
|
const blackboard = Blackboard;
|
|
399
169
|
exports.Blackboard = __webpack_exports__.Blackboard;
|
|
400
170
|
exports["default"] = __webpack_exports__["default"];
|
|
401
|
-
exports.pointMarkForItem = __webpack_exports__.pointMarkForItem;
|
|
402
|
-
exports.rectMarkForItem = __webpack_exports__.rectMarkForItem;
|
|
403
171
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
404
172
|
"Blackboard",
|
|
405
|
-
"default"
|
|
406
|
-
"pointMarkForItem",
|
|
407
|
-
"rectMarkForItem"
|
|
173
|
+
"default"
|
|
408
174
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
409
175
|
Object.defineProperty(exports, '__esModule', {
|
|
410
176
|
value: true
|