Skip to content

Commit

Permalink
fix: moveable ref 修复
Browse files Browse the repository at this point in the history
  • Loading branch information
limaofeng committed Jul 23, 2022
1 parent a7ffa98 commit 9c14b0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/scena/viewport/MoveableManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function MoveableManager(props: MoveableManagerProps) {
}, [ref]);

useEffect(() => {
dispatch({ type: ActionType.MoveableRef, payload: ref.current });
dispatch({ type: ActionType.MoveableRef, payload: ref });
}, [dispatch]);

useEffect(() => {
Expand Down
5 changes: 4 additions & 1 deletion stories/State.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { Meta, Story } from '@storybook/react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import AsanyEditor, { useEditor } from '../src';
import AsanyEditor, { useEditor, useSelector } from '../src';

import DemoPlugin from './editors/demo';

Expand All @@ -18,6 +18,8 @@ const meta: Meta = {
function MoveableTest() {
const editor = useEditor();

const moveable = useSelector((state) => state.ui.scena.moveable.ref);

useEffect(() => {
editor.scena.setSelectedTargets([document.getElementById('moveable_test')!]);

Expand All @@ -29,6 +31,7 @@ function MoveableTest() {
});
document.getElementById('moveable_test')?.addEventListener('moveable.resizeStop', (e) => {
console.log('moveable.resizeStop', e);
console.log('moveable', moveable);
});
}, []);

Expand Down

0 comments on commit 9c14b0d

Please sign in to comment.