Skip to content

Commit

Permalink
BUGFIX: Keep commandbar centered after it’s opened and not dragged yet
Browse files Browse the repository at this point in the history
Sebobo committed Mar 15, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4208df1 commit f291ecd
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Resources/Public/Module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/Module.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/Plugin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/Plugin.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ const CommandBarDialog: React.FC<CommandBarDialogProps> = ({ onDrag, open, toggl
const dialogStyle = useComputed(() => {
const { left, top } = dialogPosition.value;
return (
hasBeenDragged
hasBeenDragged.value
? {
left: left + 'px',
top: top + 'px',
@@ -99,10 +99,10 @@ const CommandBarDialog: React.FC<CommandBarDialogProps> = ({ onDrag, open, toggl

useEffect(() => {
if (!open) return;
dialogRef.current.parentElement.addEventListener('drop', handleDragDrop);
dialogRef.current?.parentElement?.addEventListener('drop', handleDragDrop);
window.addEventListener('resize', onResize);
return () => {
dialogRef.current.parentElement.removeEventListener('drop', handleDragDrop);
dialogRef.current?.parentElement?.removeEventListener('drop', handleDragDrop);
window.removeEventListener('resize', onResize);
};
}, [open, onResize, handleDragDrop]);

0 comments on commit f291ecd

Please sign in to comment.