@lvce-editor/renderer-process 23.1.0 → 23.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.
- package/dist/rendererProcessMain.js +22 -3
- package/package.json +1 -1
|
@@ -1091,12 +1091,20 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
|
|
|
1091
1091
|
break;
|
|
1092
1092
|
case NavigateChild:
|
|
1093
1093
|
{
|
|
1094
|
-
const $
|
|
1094
|
+
const $Children = $Current.childNodes;
|
|
1095
|
+
const $Child = $Children[patch.index];
|
|
1095
1096
|
if (!$Child) {
|
|
1097
|
+
const nextPatch = patches[patchIndex + 1];
|
|
1098
|
+
if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
|
|
1099
|
+
const $Placeholder = document.createComment('virtual-dom-placeholder');
|
|
1100
|
+
$Current.append($Placeholder);
|
|
1101
|
+
$Current = $Placeholder;
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1096
1104
|
console.error('Cannot navigate to child: child not found at index', {
|
|
1097
1105
|
$Current,
|
|
1098
1106
|
index: patch.index,
|
|
1099
|
-
childCount: $
|
|
1107
|
+
childCount: $Children.length
|
|
1100
1108
|
});
|
|
1101
1109
|
return;
|
|
1102
1110
|
}
|
|
@@ -3730,7 +3738,18 @@ const getEventClass = eventType => {
|
|
|
3730
3738
|
};
|
|
3731
3739
|
|
|
3732
3740
|
const mouseEvent = (element, eventType, options) => {
|
|
3733
|
-
|
|
3741
|
+
// Get the element's bounding rect and calculate center position
|
|
3742
|
+
const rect = element.getBoundingClientRect();
|
|
3743
|
+
const centerX = rect.left + rect.width / 2;
|
|
3744
|
+
const centerY = rect.top + rect.height / 2;
|
|
3745
|
+
|
|
3746
|
+
// Ensure clientX and clientY are set if not provided
|
|
3747
|
+
const eventOptions = {
|
|
3748
|
+
...options,
|
|
3749
|
+
clientX: options?.clientX ?? centerX,
|
|
3750
|
+
clientY: options?.clientY ?? centerY
|
|
3751
|
+
};
|
|
3752
|
+
const event = new MouseEvent(eventType, eventOptions);
|
|
3734
3753
|
element.dispatchEvent(event);
|
|
3735
3754
|
};
|
|
3736
3755
|
const mouseDown = (element, options) => {
|