Skip to content

Commit

Permalink
feat: update pages
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshenhai committed Jun 30, 2024
2 parents a62f314 + aa18df4 commit efbc8b0
Show file tree
Hide file tree
Showing 147 changed files with 9,597 additions and 248 deletions.
44 changes: 22 additions & 22 deletions docs/assets/index-lOL8ihAD.js → docs/assets/index-B9_qItwe.js

Large diffs are not rendered by default.

3,236 changes: 3,236 additions & 0 deletions docs/demo/advanced-data/data.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/demo/advanced-data/import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"idraw": "./lib/idraw.esm.js",
"./data": "./demo/basic/data.js"
}
}
12 changes: 12 additions & 0 deletions docs/demo/advanced-data/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

#app {
margin-top: 20px;
text-align: center;
}
1 change: 1 addition & 0 deletions docs/demo/advanced-data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="app"></div>
12 changes: 12 additions & 0 deletions docs/demo/advanced-data/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { iDraw } from 'idraw';
import data from './data';

const app = document.querySelector('#app');
const options = {
width: 500,
height: 600,
devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.centerContent();
54 changes: 54 additions & 0 deletions docs/demo/api-getImageBlobURL/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export default {
// background: '#f0f0f0',
elements: [
{
uuid: '98e31597-b745-7d6f-4164-920b8a4e8f36',
name: 'rect-001',
x: 20,
y: 20,
w: 100,
h: 100,
type: 'rect',
detail: {
background: '#d5f5f9',
borderRadius: 20,
borderWidth: 10,
borderColor: '#3f51b5'
}
},
{
uuid: '28774435-b994-1016-1c17-95912f719bab',
name: 'rect-002',
x: 140,
y: 100,
w: 200,
h: 200,
// angle: 30,
type: 'rect',
detail: {
background: '#8bc34a',
borderRadius: 20,
borderWidth: 10,
borderColor: '#009688'
}
},
{
uuid: '44dbb2c1-3588-385c-6b46-327c6adb438a',
name: 'rect-004',
x: 400,
y: 250,
w: 200,
h: 200,
type: 'rect',
detail: {
background: '#ffeb3b',
borderRadius: 20,
borderWidth: 10,
borderColor: '#ff9800'
},
operations: {
lock: true
}
}
]
};
6 changes: 6 additions & 0 deletions docs/demo/api-getImageBlobURL/import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"idraw": "./lib/idraw.esm.js",
"./data": "./demo/basic/data.js"
}
}
12 changes: 12 additions & 0 deletions docs/demo/api-getImageBlobURL/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

#app {
margin-top: 20px;
text-align: center;
}
5 changes: 5 additions & 0 deletions docs/demo/api-getImageBlobURL/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div id="app"></div>
<br />
<button id="btn-getImageBlobURL">getImageBlobURL</button>
<br />
<div id="box-preview"></div>
31 changes: 31 additions & 0 deletions docs/demo/api-getImageBlobURL/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { iDraw } from 'idraw';
import data from './data';

const app = document.querySelector('#app');
const options = {
width: 320,
height: 320,
devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.setMode('select');

const btn = document.querySelector('#btn-getImageBlobURL');
const preview = document.querySelector('#box-preview');

btn.addEventListener('click', () => {
idraw
.getImageBlobURL({ devicePixelRatio: 1 })
.then((res) => {
const { blobURL, width, height, devicePixelRatio } = res;
preview.innerHTML = `
<div>${JSON.stringify(res, null, 2)}</div>
<img width="320" src="${blobURL}" />
`;
})
.catch((err) => {
console.error(err);
window.alert(JSON.stringify(err));
});
});
54 changes: 54 additions & 0 deletions docs/demo/custom-style-info/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export default {
// background: '#f0f0f0',
elements: [
{
uuid: '98e31597-b745-7d6f-4164-920b8a4e8f36',
name: 'rect-001',
x: 20,
y: 20,
w: 100,
h: 100,
type: 'rect',
detail: {
background: '#d5f5f9',
borderRadius: 20,
borderWidth: 10,
borderColor: '#3f51b5'
}
},
{
uuid: '28774435-b994-1016-1c17-95912f719bab',
name: 'rect-002',
x: 140,
y: 100,
w: 200,
h: 200,
// angle: 30,
type: 'rect',
detail: {
background: '#8bc34a',
borderRadius: 20,
borderWidth: 10,
borderColor: '#009688'
}
},
{
uuid: '44dbb2c1-3588-385c-6b46-327c6adb438a',
name: 'rect-004',
x: 400,
y: 250,
w: 200,
h: 200,
type: 'rect',
detail: {
background: '#ffeb3b',
borderRadius: 20,
borderWidth: 10,
borderColor: '#ff9800'
},
operations: {
lock: true
}
}
]
};
6 changes: 6 additions & 0 deletions docs/demo/custom-style-info/import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"idraw": "./lib/idraw.esm.js",
"./data": "./demo/basic/data.js"
}
}
12 changes: 12 additions & 0 deletions docs/demo/custom-style-info/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

#app {
margin-top: 20px;
text-align: center;
}
1 change: 1 addition & 0 deletions docs/demo/custom-style-info/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="app"></div>
19 changes: 19 additions & 0 deletions docs/demo/custom-style-info/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { iDraw } from 'idraw';
import data from './data';

const app = document.querySelector('#app');
const options = {
width: 320,
height: 320,
devicePixelRatio: 2,
styles: {
info: {
textBackground: '#9c27b0',
textColor: '#ffeb3b'
}
}
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.centerContent();
idraw.selectElements([data.elements[1].uuid]);
54 changes: 54 additions & 0 deletions docs/demo/custom-style-ruler/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export default {
// background: '#f0f0f0',
elements: [
{
uuid: '98e31597-b745-7d6f-4164-920b8a4e8f36',
name: 'rect-001',
x: 20,
y: 20,
w: 100,
h: 100,
type: 'rect',
detail: {
background: '#d5f5f9',
borderRadius: 20,
borderWidth: 10,
borderColor: '#3f51b5'
}
},
{
uuid: '28774435-b994-1016-1c17-95912f719bab',
name: 'rect-002',
x: 140,
y: 100,
w: 200,
h: 200,
// angle: 30,
type: 'rect',
detail: {
background: '#8bc34a',
borderRadius: 20,
borderWidth: 10,
borderColor: '#009688'
}
},
{
uuid: '44dbb2c1-3588-385c-6b46-327c6adb438a',
name: 'rect-004',
x: 400,
y: 250,
w: 200,
h: 200,
type: 'rect',
detail: {
background: '#ffeb3b',
borderRadius: 20,
borderWidth: 10,
borderColor: '#ff9800'
},
operations: {
lock: true
}
}
]
};
6 changes: 6 additions & 0 deletions docs/demo/custom-style-ruler/import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"idraw": "./lib/idraw.esm.js",
"./data": "./demo/basic/data.js"
}
}
12 changes: 12 additions & 0 deletions docs/demo/custom-style-ruler/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}

#app {
margin-top: 20px;
text-align: center;
}
1 change: 1 addition & 0 deletions docs/demo/custom-style-ruler/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="app"></div>
24 changes: 24 additions & 0 deletions docs/demo/custom-style-ruler/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { iDraw } from 'idraw';
import data from './data';

const app = document.querySelector('#app');
const options = {
width: 320,
height: 320,
devicePixelRatio: 2,
styles: {
ruler: {
background: '#0000FF1A',
borderColor: '#0000FF',
scaleColor: '#FF0000',
textColor: '#000000',
gridColor: '#0000FF1C',
gridPrimaryColor: '#0000FF6C',
selectedAreaColor: '#FF0000CC'
}
}
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.centerContent();
idraw.selectElements([data.elements[1].uuid]);
Loading

0 comments on commit efbc8b0

Please sign in to comment.