# idraw
**Repository Path**: wangdl_qd/idraw
## Basic Information
- **Project Name**: idraw
- **Description**: 一个面向Web绘图的JavaScript框架。(A simple JavaScript framework for Drawing on the web.)
- **Primary Language**: TypeScript
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 3
- **Created**: 2022-03-03
- **Last Updated**: 2022-03-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
iDraw.js
iDraw.js is a simple JavaScript framework for Drawing on the web.
一个面向Web绘图的JavaScript框架
idraw.js.org
- [Documents](https://idraw.js.org/docs/en/) | [中文文档](https://idraw.js.org/docs/zh/)
- [Online Playground](https://idraw.js.org/playground/) | [在线API示例](https://idraw.js.org/playground/)
- [Online Studio](https://idraw.js.org/studio/) | [在线绘图演示](https://idraw.js.org/studio/)
## @idraw/studio Preview
The preview of `@idraw/studo`. Click [here](https://github.com/idrawjs/studio) to get it.
## Install
```
npm i idraw
```
## Getting Started
### Common
```js
import iDraw from 'idraw';
const idraw = new iDraw(
document.querySelector('#app'),
{
width: 600,
height: 400,
contextWidth: 600,
contextHeight: 400,
devicePixelRatio: 1,
}
);
idraw.addElement({
name: "rect-1",
x: 140,
y: 120,
w: 200,
h: 100,
type: "rect",
desc: {
bgColor: "#f7d3c1",
borderRadius: 20,
borderWidth: 4,
borderColor: "#ff6032",
},
});
```
### React
```jsx
import iDraw from 'idraw';
import { useEffect, useRef } from 'react';
function Demo() {
const ref = useRef(null);
useEffect(() => {
const idraw = new iDraw(ref.current, {
width: 600,
height: 400,
contextWidth: 600,
contextHeight: 400,
devicePixelRatio: 1,
});
idraw.addElement({
name: "rect-001",
x: 140,
y: 120,
w: 200,
h: 100,
type: "rect",
desc: {
bgColor: "#f7d3c1",
borderRadius: 20,
borderWidth: 4,
borderColor: "#ff6032",
},
})
}, []);
return (
)
}
```
### Vue
```html
```
## Contributing
We appreciate your help!
To contribute, please follow the steps:
### Step 1: Prepare Project
- `git clone git@github.com:idrawjs/idraw.git`
- `cd idraw`
- `npm i`
- `npm run init`
### Step 2: Development
#### Simple Mode
- `npm run start` to select and develop single package
#### Complete Mode
- `npm run dev` for compiling all packages
- `npm run dev ${module}` for compiling single module such as `idraw`
- `npm run serve` for starting a server
- http://127.0.0.1:8080
- http://127.0.0.1:8080/packages/idraw/examples/features/
- http://127.0.0.1:8080/packages/core/examples/features/