Skip to content

Commit

Permalink
Merge pull request #73 from idrawjs/dev-v0.4
Browse files Browse the repository at this point in the history
feat: upgrade deps and mode usage
  • Loading branch information
chenshenhai authored Mar 10, 2024
2 parents 8911167 + f08f767 commit 31a143d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 49 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": false,
"version": "0.4.0-alpha.15",
"version": "0.4.0-alpha.16",
"workspaces": [
"packages/*"
],
Expand All @@ -19,7 +19,7 @@
"upgrade:version": "vite-node ./scripts/upgrade-version.ts && pnpm i"
},
"dependencies": {
"idraw": "0.4.0-beta.15",
"idraw": "0.4.0-beta.16",
"antd": "5.12.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idraw/studio-base",
"version": "0.4.0-alpha.15",
"version": "0.4.0-alpha.16",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -22,7 +22,7 @@
"peerDependencies": {
"antd": "^5.12.1",
"classnames": "^2.3.2",
"idraw": "^0.4.0-beta.15",
"idraw": "^0.4.0-beta.16",
"react": "^18.2.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idraw/studio",
"version": "0.4.0-alpha.15",
"version": "0.4.0-alpha.16",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -20,13 +20,13 @@
"author": "chenshenhai",
"license": "MIT",
"dependencies": {
"@idraw/studio-base": "^0.4.0-alpha.15",
"@idraw/studio-base": "^0.4.0-alpha.16",
"classnames": "^2.3.2",
"is-hotkey": "^0.2.0"
},
"peerDependencies": {
"antd": "^5.12.1",
"idraw": "^0.4.0-beta.15",
"idraw": "^0.4.0-beta.16",
"react": "^18.2.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0"
Expand Down
1 change: 1 addition & 0 deletions packages/studio/src/modules/sketch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const Sketch = (props: SketchProps) => {
devicePixelRatio: window.devicePixelRatio
};
const idraw = new iDraw(ref.current, options);
idraw.enable('ruler');
refIDraw.current = idraw;

const listenMiddlewareEventSelect = (e: { uuids: string[]; positions: ElementPosition[] }) => {
Expand Down
17 changes: 11 additions & 6 deletions packages/studio/src/modules/toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ export const Toolbar = (props: ToolbarProps) => {

useEffect(() => {
const idraw = sharedStore.get('idraw');
idraw?.reset({
enableRuler: toggleRuler,
enableDrag: toggleDrag,
enableSelect: !toggleDrag
});
}, [toggleDrag, toggleRuler]);
if (toggleRuler === true) {
idraw?.enable('ruler');
} else {
idraw?.disable('ruler');
}
}, [toggleRuler]);

useEffect(() => {
const idraw = sharedStore.get('idraw');
idraw?.setMode(toggleDrag ? 'drag' : 'select');
}, [toggleDrag]);

const btnProps: ButtonProps = {
size: 'small',
Expand Down
80 changes: 44 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31a143d

Please sign in to comment.