Fix middle alignment of preview design.
This commit is contained in:
Vendored
+11
-2
@@ -11554,6 +11554,10 @@ function DesignPreview({
|
|||||||
});
|
});
|
||||||
const [opacity, setOpacity] = react.exports.useState(100);
|
const [opacity, setOpacity] = react.exports.useState(100);
|
||||||
const keyDownHandler = react.exports.useCallback(function (e) {
|
const keyDownHandler = react.exports.useCallback(function (e) {
|
||||||
|
if (!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const step = e.shiftKey ? 10 : 1;
|
const step = e.shiftKey ? 10 : 1;
|
||||||
|
|
||||||
if (e.key === 'ArrowUp') {
|
if (e.key === 'ArrowUp') {
|
||||||
@@ -11573,13 +11577,18 @@ function DesignPreview({
|
|||||||
x: step
|
x: step
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}, [position]);
|
}, [position, active]);
|
||||||
react.exports.useEffect(() => {
|
react.exports.useEffect(() => {
|
||||||
document.addEventListener('keydown', keyDownHandler);
|
document.addEventListener('keydown', keyDownHandler);
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keydown', keyDownHandler);
|
document.removeEventListener('keydown', keyDownHandler);
|
||||||
};
|
};
|
||||||
}, [keyDownHandler]);
|
}, [keyDownHandler]);
|
||||||
|
react.exports.useEffect(() => {
|
||||||
|
updatePosition({
|
||||||
|
x: getInitialXPosition(previewOption)
|
||||||
|
});
|
||||||
|
}, [previewOption.widthDimension]);
|
||||||
|
|
||||||
if (!previewOption) {
|
if (!previewOption) {
|
||||||
return;
|
return;
|
||||||
@@ -11706,7 +11715,7 @@ function DataOptions(props = {}) {
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
react.exports.useEffect(async () => {
|
react.exports.useEffect(() => {
|
||||||
document.addEventListener("keydown", handleCloseSidebarEscEvent); // Unsubscribe from ESC listener.
|
document.addEventListener("keydown", handleCloseSidebarEscEvent); // Unsubscribe from ESC listener.
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -31,7 +31,7 @@ function DataOptions(props = {}) {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(async () => {
|
useEffect(() => {
|
||||||
document.addEventListener("keydown", handleCloseSidebarEscEvent);
|
document.addEventListener("keydown", handleCloseSidebarEscEvent);
|
||||||
|
|
||||||
// Unsubscribe from ESC listener.
|
// Unsubscribe from ESC listener.
|
||||||
@@ -103,7 +103,7 @@ function DataOptions(props = {}) {
|
|||||||
dataOptions.sort((a, b) => b.widthDimension - a.widthDimension);
|
dataOptions.sort((a, b) => b.widthDimension - a.widthDimension);
|
||||||
|
|
||||||
return dataOptions.find((item) => {
|
return dataOptions.find((item) => {
|
||||||
return item.widthDimension; // first
|
return item.widthDimension // first
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ export function DesignPreview({previewOption = {widthDimension: 0}}) {
|
|||||||
|
|
||||||
const keyDownHandler = useCallback(
|
const keyDownHandler = useCallback(
|
||||||
function (e) {
|
function (e) {
|
||||||
|
if (!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const step = e.shiftKey ? 10 : 1;
|
const step = e.shiftKey ? 10 : 1;
|
||||||
if (e.key === 'ArrowUp') {
|
if (e.key === 'ArrowUp') {
|
||||||
updatePosition({y: step * -1}, true)
|
updatePosition({y: step * -1}, true)
|
||||||
@@ -22,7 +26,7 @@ export function DesignPreview({previewOption = {widthDimension: 0}}) {
|
|||||||
updatePosition({x: step}, true)
|
updatePosition({x: step}, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [position]);
|
}, [position, active]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('keydown', keyDownHandler);
|
document.addEventListener('keydown', keyDownHandler);
|
||||||
@@ -32,6 +36,10 @@ export function DesignPreview({previewOption = {widthDimension: 0}}) {
|
|||||||
}
|
}
|
||||||
}, [keyDownHandler]);
|
}, [keyDownHandler]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updatePosition({x: getInitialXPosition(previewOption)});
|
||||||
|
}, [previewOption.widthDimension])
|
||||||
|
|
||||||
if (!previewOption) {
|
if (!previewOption) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user