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
  • Loading branch information
Sebobo committed Mar 15, 2023
1 parent 4208df1 commit f291ecd
Show file tree
Hide file tree
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
Expand Up @@ -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',
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit f291ecd

Please sign in to comment.