diff --git a/docs/README.md b/docs/README.md
deleted file mode 100644
index 7c90cca..0000000
--- a/docs/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Documents
-
-## Usage
-
-- Site: https://idrawjs.github.io/
-- Repos: https://github.com/idrawjs/docs
-
-## TODO List
-
-- https://github.com/idrawjs/idraw/issues/53
\ No newline at end of file
diff --git a/examples/board/features/lib/action.js b/examples/board/features/lib/action.js
deleted file mode 100644
index f6cb461..0000000
--- a/examples/board/features/lib/action.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import { getData } from "./data.js";
-import { drawData } from './draw.js';
-import { getScale } from './scale.js';
-import opts from './opts.js'
-
-function isPointInElement(board, p = {x, y}) {
- const ctx = board.getContext();
- const data = getData();
- let idx = -1;
- for (let i = data.elements.length - 1; i >= 0; i--) {
- const ele = data.elements[i];
- ctx.beginPath();
- ctx.lineTo(ele.x, ele.y);
- ctx.lineTo(ele.x + ele.w, ele.y);
- ctx.lineTo(ele.x + ele.w, ele.y + ele.h);
- ctx.lineTo(ele.x, ele.y + ele.h);
- ctx.closePath();
-
- if (ctx.isPointInPath(p.x, p.y)) {
- idx = i;
- break;
- }
- }
- return idx;
-}
-
-function moveElement(board, idx, moveX, moveY) {
- const data = getData();
- const scale = getScale() || 1;
- if (data.elements[idx]) {
- // data.elements[idx].x += (moveX * scale * opts.devicePixelRatio);
- // data.elements[idx].y += (moveY * scale * opts.devicePixelRatio);
- data.elements[idx].x += (moveX / scale);
- data.elements[idx].y += (moveY / scale);
- }
- drawData(board, idx)
-}
-
-const cursor = document.querySelector('#cursor');
-const resetCursor = document.querySelector('#reset-cursor');
-let hasInitedCursor = false;
-function doCursor(board) {
- if (hasInitedCursor === true) {
- return;
- }
- cursor.addEventListener('change', () => {
- // console.log('cursor.value = ', cursor.value);
- board.setCursor(cursor.value);
- });
- resetCursor.addEventListener('click', () => {
- board.resetCursor();
- });
- hasInitedCursor = true;
-}
-
-export {
- isPointInElement,
- moveElement,
- doCursor
-}
\ No newline at end of file
diff --git a/examples/board/features/lib/data.js b/examples/board/features/lib/data.js
deleted file mode 100644
index 6c27ea0..0000000
--- a/examples/board/features/lib/data.js
+++ /dev/null
@@ -1,60 +0,0 @@
-const data = {
- elements: [
- {
- x: 10,
- y: 10,
- w: 200,
- h: 120,
- type: "rect",
- desc: {
- color: "#f0f0f0",
- },
- },
- {
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- type: "rect",
- desc: {
- color: "#cccccc",
- },
- },
- {
- x: 160,
- y: 160,
- w: 200,
- h: 120,
- type: "rect",
- desc: {
- color: "#c0c0c0",
- },
- },
- {
- x: 400 - 10,
- y: 300 - 10,
- w: 200,
- h: 100,
- type: "rect",
- desc: {
- color: "#e0e0e0",
- },
- },
- {
- x: 300 - 10,
- y: 200 - 10,
- w: 20,
- h: 20,
- type: "rect",
- desc: {
- color: "#000000",
- },
- },
- ],
-};
-
-function getData() {
- return data;
-}
-
-export { getData };
diff --git a/examples/board/features/lib/draw.js b/examples/board/features/lib/draw.js
deleted file mode 100644
index 36e6e4b..0000000
--- a/examples/board/features/lib/draw.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import opts from './opts.js';
-import { getData } from './data.js';
-
-export function drawData(board, idx) {
- const ctx = board.getContext();
- const helperCtx = board.getHelperContext();
- const data = getData();
- board.clear();
- ctx.clearRect(0, 0, opts.devicePixelRatio * opts.contextWidth, opts.devicePixelRatio * opts.contextHeight);
- helperCtx.clearRect(0, 0, opts.devicePixelRatio * opts.contextWidth, opts.devicePixelRatio * opts.contextHeight);
-
- // ctx.setFillStyle('#ffffff');
- // ctx.fillRect(0, 0, opts.width, opts.height);
-
- data.elements.forEach((ele, i) => {
- ctx.setFillStyle(ele.desc.color);
- ctx.fillRect(ele.x, ele.y, ele.w, ele.h);
-
- // helperCtx.setFillStyle('#2196f3');
- // helperCtx.fillRect(ele.x, ele.y, ele.w, ele.h);
-
- if (i === idx) {
- helperCtx.beginPath();
- helperCtx.setLineDash([4, 4]);
- helperCtx.setLineWidth(2);
- helperCtx.setStrokeStyle('#2196f3');
- helperCtx.moveTo(ele.x, ele.y);
- helperCtx.lineTo(ele.x + ele.w, ele.y);
- helperCtx.lineTo(ele.x + ele.w, ele.y + ele.h);
- helperCtx.lineTo(ele.x, ele.y + ele.h);
- helperCtx.lineTo(ele.x, ele.y);
- helperCtx.stroke();
- helperCtx.closePath();
- }
- });
- board.draw();
-}
\ No newline at end of file
diff --git a/examples/board/features/lib/event.js b/examples/board/features/lib/event.js
deleted file mode 100644
index 15a8799..0000000
--- a/examples/board/features/lib/event.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import { isPointInElement, moveElement } from './action.js';
-
-let selectIdx = -1;
-let prevPoint = { x: null, y: null };
-
-export function initEvent(board) {
-
- board.on('point', (p) => {
- selectIdx = isPointInElement(board, p);
- });
-
- board.on('move', (p) => {
- moveElement(board, selectIdx, p.x - prevPoint.x, p.y - prevPoint.y);
- prevPoint = p;
- });
-
- board.on('moveStart', (p) => {
- prevPoint = p;
- });
-
- board.on('moveEnd', (p) => {
- selectIdx = false;
- });
-
- board.on('scale', (num) => {
- console.log('on("scale") = ', num);
- });
-
- board.on('scrollX', (num) => {
- console.log('on("scrollX") = ', num);
- });
-
- board.on('scrollX', (num) => {
- console.log('on("scrollX") = ', num);
- });
-
- board.on('hover', (p) => {
- // console.log('hover', p);
- })
-
- board.on('doubleClick', (p) => {
- console.log('on("doubleClick")', p);
- })
-}
\ No newline at end of file
diff --git a/examples/board/features/lib/opts.js b/examples/board/features/lib/opts.js
deleted file mode 100644
index 6f62fe1..0000000
--- a/examples/board/features/lib/opts.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export default {
- width: 400,
- height: 300,
- contextWidth: 600,
- contextHeight: 400,
- devicePixelRatio: 4,
- canScroll: true,
- scrollConfig: {
- lineWidth: 16,
- color: '#666666'
- }
-}
\ No newline at end of file
diff --git a/examples/board/features/lib/scale.js b/examples/board/features/lib/scale.js
deleted file mode 100644
index 9778920..0000000
--- a/examples/board/features/lib/scale.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const input = document.querySelector('#scale');
-let hasInited = false;
-
-export function doScale(board, scale) {
- if (hasInited === true) return;
- if (!input) {
- return;
- }
- if (scale > 0) {
- input.value = scale;
- const screen = board.scale(scale);
- console.log('scale: screen =', screen);
- board.draw();
- }
- input.addEventListener('change', () => {
- const val = input.value * 1;
- if (val > 0) {
- const screen = board.scale(val);
- console.log('scale: screen =', screen);
- board.draw();
- }
- });
- hasInited = true;
-}
-
-export function getScale() {
- if (!input) {
- return;
- }
- let val = 1;
- if (input.value * 1 > 0) {
- val = input.value * 1;
- }
- return val;
-}
\ No newline at end of file
diff --git a/examples/board/features/lib/scroll.js b/examples/board/features/lib/scroll.js
deleted file mode 100644
index 036f448..0000000
--- a/examples/board/features/lib/scroll.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const inputX = document.querySelector('#scrollX');
-const inputY = document.querySelector('#scrollY');
-let hasInited = false;
-
-export function doScroll(board, conf = {}) {
- if (hasInited === true) return;
- if (!(inputX && inputY)) {
- return;
- }
-
- if (conf.scrollX >= 0 || conf.scrollX < 0) {
- inputX.value = conf.scrollX;
- const screen = board.scrollX(conf.scrollX);
- console.log('scrollX: screen =', screen);
- board.draw();
- }
-
- if (conf.scrollY >= 0 || conf.scrollY < 0) {
- inputY.value = conf.scrollY;
- const screen = board.scrollY(conf.scrollY);
- console.log('scrollY: screen =', screen);
- board.draw();
- }
-
- inputX.addEventListener('change', () => {
- const val = inputX.value * 1;
- if (val >= 0 || val < 0) {
- const screen = board.scrollX(val);
- console.log('scrollX: screen =', screen);
- board.draw();
- }
- });
- inputY.addEventListener('change', () => {
- const val = inputY.value * 1;
- if (val >= 0 || val < 0) {
- const screen = board.scrollY(val);
- console.log('scrollY: screen =', screen);
- board.draw();
- }
- });
- hasInited = true;
-}
\ No newline at end of file
diff --git a/examples/board/features/main.html b/examples/board/features/main.html
deleted file mode 100644
index d89578c..0000000
--- a/examples/board/features/main.html
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- scale
-
-
-
- scrollX
-
-
-
- scrollY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/features/main.js b/examples/board/features/main.js
deleted file mode 100644
index 438e891..0000000
--- a/examples/board/features/main.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import opts from './lib/opts.js';
-import { drawData } from './lib/draw.js';
-import { doScale } from './lib/scale.js';
-import { doScroll } from './lib/scroll.js';
-import { initEvent } from './lib/event.js';
-import { doCursor } from './lib/action.js';
-
-const Board = window.iDrawBoard;
-
-const mount = document.querySelector('#mount');
-const board = new Board(mount, opts);
-
-const conf = {
- scale: 1
- // scrollX: 100,
- // scrollY: 200,
-};
-
-// const conf = {
-// scale: 2,
-// scrollX: -200,
-// scrollY: -100,
-// };
-
-drawData(board);
-
-initEvent(board);
-doScale(board, conf.scale);
-doScroll(board, conf);
-doCursor(board);
-
-console.log(
- 'pointScreenToContext = ',
- board.pointScreenToContext({ x: 400, y: 300 })
-);
-
-console.log(
- 'pointContextToScreen = ',
- board.pointContextToScreen({ x: 300, y: 200 })
-);
-
-// board.scale(2);
-// board.draw();
diff --git a/examples/board/features/parent.html b/examples/board/features/parent.html
deleted file mode 100644
index 3562972..0000000
--- a/examples/board/features/parent.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/features/top.html b/examples/board/features/top.html
deleted file mode 100644
index e3d6767..0000000
--- a/examples/board/features/top.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/test/event.html b/examples/board/test/event.html
deleted file mode 100644
index 1cc2f00..0000000
--- a/examples/board/test/event.html
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/test/main.html b/examples/board/test/main.html
deleted file mode 100644
index cef4d94..0000000
--- a/examples/board/test/main.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/test/scale.html b/examples/board/test/scale.html
deleted file mode 100644
index 8664ba8..0000000
--- a/examples/board/test/scale.html
+++ /dev/null
@@ -1,218 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Scale 2 to 1 and Scroll
-
-
-
-
Scale 0.5 and Console result
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/board/test/scroll.html b/examples/board/test/scroll.html
deleted file mode 100644
index 0b31e23..0000000
--- a/examples/board/test/scroll.html
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
Scroll by scrollX/scrollY
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/features/css/index.css b/examples/core/features/css/index.css
deleted file mode 100644
index b7f6646..0000000
--- a/examples/core/features/css/index.css
+++ /dev/null
@@ -1,103 +0,0 @@
-html, body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- font-size: 12px;
- color: #333333;
-}
-
-#mount canvas {
- /* border-right: 1px solid #aaaaaa40; */
- border: 1px solid #aaaaaa2a;
- background-image:
- linear-gradient(#aaaaaa2a 1px, transparent 0),
- linear-gradient(90deg, #aaaaaa2a 1px, transparent 0),
- linear-gradient(#aaaaaa4a 1px, transparent 0),
- linear-gradient(90deg, #aaaaaa4a 1px, transparent 0);
- background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
-}
-
-.dashboard {
- display: flex;
- width: 100%;
- flex-direction: column;
-}
-
-.dashboard .row {
- /* margin-top: 20px; */
- display: flex;
- width: 100%;
- flex-direction: row;
-}
-
-.dashboard .row .col {
- display: flex;
- /* flex: 1;
- width: 100%; */
-}
-
-.center {
- justify-content: center;
- align-items: center;
-}
-
-
-.transform {
- display: flex;
- margin-top: 10px;
-}
-
-.transform input {
- width: 100px;
- margin-right: 12px;
-}
-
-.elem-item {
- height: 32px;
- min-width: 300px;
- border: 1px solid #999999;
- border-bottom: none;
- line-height: 30px;
- color: #666;
- font-size: 14px;
- user-select: none;
-}
-
-.elem-item:last-child {
- border-bottom: 1px solid #999999;
-}
-
-.elem-item-name {
- margin: 0 10px;
- cursor: pointer;
-}
-
-.elem-item-btn {
- float: right;
- font-size: 12px;
- height: 24px;
- min-width: 40px;
- padding: 0 6px;
- border-radius: 12px;
- border: 1px solid #cccccc;
- text-align: center;
- line-height: 24px;
- margin-top: 2px;
- margin-right: 6px;
- cursor: pointer;
-}
-
-.btn-hidden {
- visibility: hidden;
-}
-
-.elem-item-btn:hover {
- color: #4183c4;
- border-color: #4183c4;
-}
-
-#mount {
- margin-top: 20px;
- margin-left: 20px;
-}
\ No newline at end of file
diff --git a/examples/core/features/lib/data/circle.js b/examples/core/features/lib/data/circle.js
deleted file mode 100644
index a934c9f..0000000
--- a/examples/core/features/lib/data/circle.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "circle-001",
- x: 10,
- y: 10,
- w: 100,
- h: 100,
- type: "circle",
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#999999',
-
- shadowColor: '#03a9f4',
- // shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- {
- name: "circle-002",
- x: 100,
- y: 80,
- w: 200,
- h: 100,
- angle: 30,
- type: "circle",
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#666666',
-
- },
- },
- {
- name: "circle-003",
- x: 200,
- y: 200,
- w: 200,
- h: 100,
- type: "circle",
- angle: 0,
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#666666'
- },
- },
- {
- name: "circle-004",
- x: 220,
- y: 80,
- w: 300,
- h: 300,
- type: "circle",
- desc: {
- // bgColor: "#f0f0f0",
- bgColor: "#000000",
- borderWidth: 10,
- borderColor: '#666666',
-
- shadowColor: '#03a9f4',
- // shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/data/html.js b/examples/core/features/lib/data/html.js
deleted file mode 100644
index 8a87825..0000000
--- a/examples/core/features/lib/data/html.js
+++ /dev/null
@@ -1,91 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "html-001",
- x: 40,
- y: 40,
- w: 200,
- h: 70,
- type: "html",
- angle: 0,
- desc: {
- html: `
-
- Hello World!
-
-
-
- Hello World!
-
- `,
- },
- },
-
- {
- name: "html-001",
- x: 200,
- y: 120,
- w: 240,
- h: 240,
- type: "html",
- angle: 0,
- desc: {
- width: 120,
- height: 80,
- html: `
-
-
-
-
-
-
-
-
-
-
- `,
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/data/image.js b/examples/core/features/lib/data/image.js
deleted file mode 100644
index 02ed840..0000000
--- a/examples/core/features/lib/data/image.js
+++ /dev/null
@@ -1,83 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "image-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "image",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- // angle: 30,
- // angle: 0,
- desc: {
- src: "./../images/computer.png",
- },
- },
- {
- name: "image-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- type: "image",
- desc: {
- src: "./../images/chart.png",
- },
- },
- {
- name: "image-003",
- x: 160,
- y: 160,
- w: 200,
- h: 100,
- type: "image",
- angle: 45,
- desc: {
- src: "./../images/phone.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 10,
- y: 300 - 10,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../images/building-001.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 40,
- y: 300 - 40,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../images/building-002.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 100,
- y: 300 - 100,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../images/building-003.png",
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/data/index.js b/examples/core/features/lib/data/index.js
deleted file mode 100644
index 4bd0982..0000000
--- a/examples/core/features/lib/data/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import dataRect from "./rect.js";
-import dataImage from "./image.js";
-import dataSVG from "./svg.js";
-import dataText from "./text.js";
-import dataCircle from "./circle.js";
-
-const url = new URLSearchParams(window.location.search);
-
-const dataMap = {
- rect: dataRect,
- image: dataImage,
- svg: dataSVG,
- text: dataText,
- circle: dataCircle,
-};
-
-export function getData() {
- return dataMap[getPageName()] || dataMap[url.get("data")] || dataMap["rect"];
-}
-
-function getPageName() {
- // const pathname = window.location.pathname || '';
- // const reg = /(?[\w+]{1,})\.html$/;
- // const page = reg.exec(pathname)?.groups?.pageName || '';
- // return page;
-
- const pathname = window.location.pathname || "";
- const list = pathname.split("/");
- let pageName = list.pop() || "";
- pageName = pageName.replace(/\.html$/gi, "");
- return pageName;
-
- // return getQueryString('data') || 'rect';
-}
-
-// function getQueryString(name) {
-// let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-// let r = window.location.search.substr(1).match(reg);
-// if (r != null) {
-// return decodeURIComponent(r[2]);
-// };
-// return null;
-// }
diff --git a/examples/core/features/lib/data/rect.js b/examples/core/features/lib/data/rect.js
deleted file mode 100644
index 2f839c4..0000000
--- a/examples/core/features/lib/data/rect.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const data = {
- // bgColor: '#f0f0f0',
- elements: [
- {
- name: "rect-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "rect",
- desc: {
- bgColor: "#f0f0f0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- type: "rect",
- operation: {
- lock: true,
- },
- desc: {
- bgColor: "#cccccc",
- borderRadius: 60,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-003",
- x: 250,
- y: 150,
- w: 150,
- h: 20,
- type: "rect",
- angle: 45,
- desc: {
- bgColor: "#c0c0c0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-004",
- x: 400 - 50,
- y: 300 - 50,
- w: 200,
- h: 100,
- type: "rect",
- desc: {
- bgColor: "#e0e0e0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- operation: {
- // disbaleScale: true,
- // disbaleRotate: true,
- }
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/data/svg.js b/examples/core/features/lib/data/svg.js
deleted file mode 100644
index 71a81e4..0000000
--- a/examples/core/features/lib/data/svg.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "svg-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "svg",
- // angle: 30,
- // angle: 0,
- desc: {
- svg: ``,
- },
- },
- {
- name: "svg-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- type: "svg",
- desc: {
- svg: '',
- },
- },
- {
- name: "svg-003",
- x: 160,
- y: 160,
- w: 200,
- h: 200,
- type: "svg",
- angle: 80,
- desc: {
- svg: '',
- },
- },
- {
- name: "svg-004",
- x: 400 - 10,
- y: 300 - 100,
- w: 200,
- h: 200,
- type: "svg",
- desc: {
- svg: '',
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/data/text.js b/examples/core/features/lib/data/text.js
deleted file mode 100644
index 3a6b0a9..0000000
--- a/examples/core/features/lib/data/text.js
+++ /dev/null
@@ -1,99 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "text-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "text",
- desc: {
- fontSize: 20,
- color: "#ffffff",
- text: "生活就像海洋,只有意志坚强的人,才能到达彼岸。",
- fontFamily: '',
- fontWeight: 'bold',
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- strokeColor: '#2196f3',
- strokeWidth: 1,
- },
- },
- {
- name: "text-002",
- x: 120,
- y: 120,
- w: 100,
- h: 60,
- // angle: 30,
- type: "text",
- desc: {
- fontSize: 40,
- fontWeight: 'blod',
- text: "Hello Text",
- // color: "#999999",
- color: "#ffffff",
- borderRadius: 60,
- borderWidth: 4,
- borderColor: "#03a9f4",
-
- textShadowColor: '#000000',
- textShadowOffsetX: 2,
- textShadowOffsetY: 2,
- textShadowBlur: 2,
-
- shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- {
- name: "text-003",
- x: 160,
- y: 160,
- w: 200,
- h: 100,
- type: "text",
- operation: {
- invisible: true,
- lock: true,
- },
- desc: {
- fontSize: 20,
- color: "#333333",
- text: "生活就像海洋,只有意志坚强的人,才能到达彼岸。",
- fontFamily: "",
- textAlign: "right",
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- },
- },
- {
- name: "text-004",
- x: 300,
- y: 240,
- w: 290,
- h: 120,
- type: "text",
- desc: {
- fontSize: 20,
- color: "#333333",
- text: "Life is like an ocean.\r\nOnly those with strong \nwill can reach the other shore.",
- fontFamily: "",
- textAlign: "right",
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/core/features/lib/element.js b/examples/core/features/lib/element.js
deleted file mode 100644
index 7263603..0000000
--- a/examples/core/features/lib/element.js
+++ /dev/null
@@ -1,72 +0,0 @@
-
-const dom = document.querySelector('#elem-list');
-
-let hasInited = false;
-
-export function doElemens(core) {
- if (hasInited === true) return;
- if (!dom) return;
- renderElemens(core);
- listenElements(core);
-}
-
-function renderElemens(core) {
- const data = core.getData();
- const elems = data.elements;
- const items = [];
- for (let i = elems.length - 1; i >= 0; i --) {
- const ele = elems[i];
- items.push(`
-
- ${ele.name || 'Unnamed'}
- Up
- Down
- Lock
- Invisible
-
- `);
- }
- dom.innerHTML = items.join('');
-}
-
-function listenElements(core) {
-
- dom.addEventListener('click', (e) => {
- if (!e.path[0]) {
- return;
- }
- const el = e.path[0];
- if (el.hasAttribute('data-elem-name')) {
- const uuid = el.getAttribute('data-elem-name');
- core.selectElement(uuid);
- } else if (el.hasAttribute('data-elem-btn-up')) {
- const uuid = el.getAttribute('data-elem-btn-up');
- core.moveUpElement(uuid);
- renderElemens(core);
- } else if (el.hasAttribute('data-elem-btn-down')) {
- const uuid = el.getAttribute('data-elem-btn-down');
- core.moveDownElement(uuid);
- renderElemens(core);
- } else if (el.hasAttribute('data-elem-btn-lock')) {
- const uuid = el.getAttribute('data-elem-btn-lock');
- const elem = core.getElement(uuid);
- if (!elem.operation) {
- elem.operation = {};
- }
- elem.operation.lock = !elem.operation.lock;
- core.updateElement(elem);
- renderElemens(core);
- } else if (el.hasAttribute('data-elem-btn-invisible')) {
- const uuid = el.getAttribute('data-elem-btn-invisible');
- const elem = core.getElement(uuid);
- if (!elem.operation) {
- elem.operation = {};
- }
- elem.operation.invisible = !elem.operation.invisible;
- core.updateElement(elem);
- renderElemens(core);
- }
- }, true);
-
-}
-
diff --git a/examples/core/features/lib/main.js b/examples/core/features/lib/main.js
deleted file mode 100644
index 121c477..0000000
--- a/examples/core/features/lib/main.js
+++ /dev/null
@@ -1,95 +0,0 @@
-import { getData } from './data/index.js';
-import { doScale } from './scale.js';
-import { doScroll } from './scroll.js';
-import { doElemens } from './element.js';
-
-const { Core } = window.iDrawCore;
-const data = getData();
-const mount = document.querySelector('#mount');
-
-const defaultConf = {
- // scale: 1.5,
- // scrollLeft: 100,
- // scrollTop: 50,
-
- scale: 0,
- scrollLeft: 0,
- scrollTop: 0,
-};
-const core = new Core(mount, {
- width: 600,
- height: 400,
- contextWidth: 600,
- contextHeight: 400,
- devicePixelRatio: 4,
- // onlyRender: true,
-}, {
- scrollWrapper: {
- use: true,
- lineWidth: 16,
- color: '#9c27b0',
- },
- elementWrapper: {
- lockColor: '#009688',
- color: '#009688',
- controllerSize: 6,
- lineWidth: 1,
- // lineDash: [12, 12],
- },
-});
-
-
-// initEvent();
-
-core.setData(data);
-
-doScale(core, defaultConf.scale);
-doScroll(core, defaultConf);
-doElemens(core);
-
-
-
-function initEvent() {
- core.on('error', (data) => {
- console.log('error: ', data);
- });
- core.on('changeData', (data) => {
- console.log('changeData: ', data);
- });
- core.on('changeScreen', (data) => {
- console.log('changeScreen: ', data);
- });
- core.on('screenSelectElement', (data) => {
- console.log('screenSelectElement: ', data);
- });
- core.on('screenClickElement', (data) => {
- console.log('screenClickElement: ', data);
- })
- core.on('mouseOverElement', (data) => {
- console.log('mouseOverElement: ', data);
- });
- core.on('mouseLeaveElement', (data) => {
- console.log('mouseLeaveElement: ', data);
- });
-
- core.on('screenMoveElementStart', (data) => {
- console.log('screenMoveElementStart: ', data);
- });
- core.on('screenMoveElementEnd', (data) => {
- console.log('screenMoveElementEnd: ', data);
- });
- core.on('screenChangeElement', (data) => {
- console.log('screenChangeElement: ', data);
- });
- core.on('screenDoubleClickElement', (p) => {
- console.log('screenDoubleClickElement ===', p)
- })
- core.on('drawFrame', () => {
- console.log(' === drawFrame === ')
- })
- core.on('drawFrameComplete', () => {
- console.log(' === drawFrameComplete === ')
- })
-
-}
-
diff --git a/examples/core/features/lib/scale.js b/examples/core/features/lib/scale.js
deleted file mode 100644
index 5be9e2b..0000000
--- a/examples/core/features/lib/scale.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const input = document.querySelector('#scale');
-let hasInited = false;
-
-export function doScale(core, scale) {
- if (hasInited === true) return;
- if (!input) return;
- if (scale > 0) {
- input.value = scale;
- core.scale(scale);
- }
- input.addEventListener('change', () => {
- const val = input.value * 1;
- if (val > 0) {
- core.scale(val);
- console.log(core.getScreenTransform());
- }
- });
- hasInited = true;
-}
-
-export function getScale() {
- let val = 1;
- if (input.value * 1 > 0) {
- val = input.value * 1;
- }
- return val;
-}
\ No newline at end of file
diff --git a/examples/core/features/lib/scroll.js b/examples/core/features/lib/scroll.js
deleted file mode 100644
index 73c9942..0000000
--- a/examples/core/features/lib/scroll.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const inputX = document.querySelector('#scrollLeft');
-const inputY = document.querySelector('#scrollTop');
-let hasInited = false;
-
-export function doScroll(core, conf = {}) {
- if (hasInited === true) return;
- if (!(inputY && inputX)) return;
-
- if (conf.scrollLeft >= 0) {
- inputX.value = conf.scrollLeft;
- core.scrollLeft(conf.scrollLeft);
- }
-
- if (conf.scrollTop >= 0) {
- inputY.value = conf.scrollTop;
- core.scrollTop(conf.scrollTop);
- }
-
- inputX.addEventListener('change', () => {
- const val = inputX.value * 1;
- if (val >= 0 || val < 0) {
- core.scrollLeft(val);
- console.log(core.getScreenTransform());
- }
- });
- inputY.addEventListener('change', () => {
- const val = inputY.value * 1;
- if (val >= 0 || val < 0) {
- core.scrollTop(val);
- console.log(core.getScreenTransform());
- }
- });
- hasInited = true;
-}
\ No newline at end of file
diff --git a/examples/core/features/main.html b/examples/core/features/main.html
deleted file mode 100644
index 8d5af73..0000000
--- a/examples/core/features/main.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/features/parent.html b/examples/core/features/parent.html
deleted file mode 100644
index 108b253..0000000
--- a/examples/core/features/parent.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/features/top.html b/examples/core/features/top.html
deleted file mode 100644
index 3591a33..0000000
--- a/examples/core/features/top.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/images/building-001.png b/examples/core/images/building-001.png
deleted file mode 100644
index 4b87e78..0000000
Binary files a/examples/core/images/building-001.png and /dev/null differ
diff --git a/examples/core/images/building-002.png b/examples/core/images/building-002.png
deleted file mode 100644
index c0699ff..0000000
Binary files a/examples/core/images/building-002.png and /dev/null differ
diff --git a/examples/core/images/building-003.png b/examples/core/images/building-003.png
deleted file mode 100644
index 5391f28..0000000
Binary files a/examples/core/images/building-003.png and /dev/null differ
diff --git a/examples/core/images/chart.png b/examples/core/images/chart.png
deleted file mode 100644
index 67efe1f..0000000
Binary files a/examples/core/images/chart.png and /dev/null differ
diff --git a/examples/core/images/computer.png b/examples/core/images/computer.png
deleted file mode 100644
index 01fde93..0000000
Binary files a/examples/core/images/computer.png and /dev/null differ
diff --git a/examples/core/images/phone.png b/examples/core/images/phone.png
deleted file mode 100644
index 4ffec7f..0000000
Binary files a/examples/core/images/phone.png and /dev/null differ
diff --git a/examples/core/test/api.html b/examples/core/test/api.html
deleted file mode 100644
index 70e1b6a..0000000
--- a/examples/core/test/api.html
+++ /dev/null
@@ -1,552 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
idraw.selectElementByIndex
-
-
-
-
-
-
-
idraw.moveDownElement
-
-
-
-
-
-
-
idraw.insertElementBefore
-
-
-
idraw.insertElementAfter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/test/data.js b/examples/core/test/data.js
deleted file mode 100644
index 5e8f82e..0000000
--- a/examples/core/test/data.js
+++ /dev/null
@@ -1,63 +0,0 @@
-const data = {
- bgColor: "#ffffff",
- elements: [
- {
- name: "rect-001",
- x: 5,
- y: 5,
- w: 100,
- h: 50,
- type: "rect",
- desc: {
- bgColor: "#ffeb3b",
- borderRadius: 10,
- borderWidth: 5,
- borderColor: "#ffc107",
- },
- },
- {
- name: "text-002",
- x: 40,
- y: 40,
- w: 100,
- h: 60,
- // angle: 30,
- type: "text",
- desc: {
- fontSize: 16,
- text: "Hello Text",
- fontWeight: 'bold',
- color: "#666666",
- borderRadius: 30,
- borderWidth: 4,
- borderColor: "#ff5722",
- },
- },
- {
- name: "image-003",
- x: 80,
- y: 80,
- w: 160,
- h: 80,
- type: "image",
- desc: {
- src: './../images/computer.png',
- },
- },
- {
- name: "svg-004",
- x: 200 - 5,
- y: 150 - 50,
- w: 100,
- h: 100,
- type: "svg",
- desc: {
- svg: '',
- },
- },
- ],
-};
-
-export function getData() {
- return data;
-}
diff --git a/examples/core/test/elements.html b/examples/core/test/elements.html
deleted file mode 100644
index 4403236..0000000
--- a/examples/core/test/elements.html
+++ /dev/null
@@ -1,514 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Element: click selected
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/test/event.html b/examples/core/test/event.html
deleted file mode 100644
index bba2bef..0000000
--- a/examples/core/test/event.html
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/core/test/resource.html b/examples/core/test/resource.html
deleted file mode 100644
index b01ceca..0000000
--- a/examples/core/test/resource.html
+++ /dev/null
@@ -1,524 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/idraw/features/css/index.css b/examples/idraw/features/css/index.css
deleted file mode 100644
index cf4d825..0000000
--- a/examples/idraw/features/css/index.css
+++ /dev/null
@@ -1,119 +0,0 @@
-html, body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- font-size: 12px;
- color: #333333;
-}
-
-#mount canvas {
- /* border-right: 1px solid #aaaaaa40; */
- border: 1px solid #aaaaaa40;
- background-image:
- linear-gradient(#aaaaaa40 1px, transparent 0),
- linear-gradient(90deg, #aaaaaa40 1px, transparent 0),
- linear-gradient(#aaa 1px, transparent 0),
- linear-gradient(90deg, #aaa 1px, transparent 0);
- background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
-}
-
-.dashboard {
- display: flex;
- width: 100%;
- flex-direction: column;
-}
-
-.dashboard .row {
- margin-top: 20px;
- display: flex;
- width: 100%;
- flex-direction: row;
-}
-
-.dashboard .row .col {
- display: flex;
- flex: 1;
- width: 100%;
- flex-direction: column;
-}
-
-.center {
- justify-content: center;
- align-items: center;
-}
-
-
-.transform {
- display: flex;
- margin-top: 10px;
-}
-
-.transform input {
- width: 100px;
- margin-right: 12px;
-}
-
-.elem-item {
- height: 32px;
- width: 200px;
- border: 1px solid #999999;
- border-bottom: none;
- line-height: 30px;
- color: #666;
- font-size: 14px;
-}
-
-.elem-item:last-child {
- border-bottom: 1px solid #999999;
-}
-
-.elem-item-name {
- margin-left: 10px;
- cursor: pointer;
-}
-
-.elem-item-btn {
- float: right;
- font-size: 12px;
- height: 24px;
- width: 40px;
- border-radius: 12px;
- border: 1px solid #cccccc;
- text-align: center;
- line-height: 24px;
- margin-top: 2px;
- margin-right: 6px;
- cursor: pointer;
-}
-
-.btn-hidden {
- visibility: hidden;
-}
-
-.elem-item-btn:hover {
- color: #4183c4;
- border-color: #4183c4;
-}
-
-.elem-menu {
- margin-top: 20px;
- display: block;
-}
-
-.elem-menu-btn {
- height: 32px;
- width: 200px;
- border: 1px solid #999999;
- border-bottom: none;
- line-height: 30px;
- color: #666;
- font-size: 14px;
- padding: 0 10px;
- box-sizing: border-box;
- cursor: pointer;
-}
-
-.elem-menu-btn:last-child {
- border-bottom: 1px solid #999999;
-}
\ No newline at end of file
diff --git a/examples/idraw/features/lib/action.js b/examples/idraw/features/lib/action.js
deleted file mode 100644
index 96ef193..0000000
--- a/examples/idraw/features/lib/action.js
+++ /dev/null
@@ -1,23 +0,0 @@
-
-const undo = document.querySelector('#elem-undo');
-const redo = document.querySelector('#elem-redo');
-let hasInited = false;
-
-export function doAction(idraw) {
- if (hasInited === true) return;
- if (undo) {
- undo.addEventListener('click', () => {
- const result = idraw.undo();
- console.log('undo: ', result);
- })
- }
-
- if (redo) {
- redo.addEventListener('click', () => {
- const result = idraw.redo();
- console.log('redo: ', result);
- })
- }
-
- hasInited = true;
-}
diff --git a/examples/idraw/features/lib/data.js b/examples/idraw/features/lib/data.js
deleted file mode 100644
index fb7d61c..0000000
--- a/examples/idraw/features/lib/data.js
+++ /dev/null
@@ -1,57 +0,0 @@
-export default {
- elements: [
- {
- name: 'rect-001',
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: 'rect',
- desc: {
- bgColor: '#f0f0f0',
- borderRadius: 20,
- borderWidth: 10,
- borderColor: '#bd0b64',
- }
- },
- {
- name: 'text-002',
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- type: 'text',
- desc: {
- fontSize: 20,
- text: 'Hello Text',
- color: '#666666',
- borderRadius: 60,
- borderWidth: 2,
- borderColor: '#bd0b64',
- }
- },
- {
- name: 'image-003',
- x: 160,
- y: 160,
- w: 200,
- h: 100,
- type: 'image',
- desc: {
- src: './../../../core/examples/images/computer.png',
- }
- },
- {
- name: 'svg-004',
- x: 400 - 10,
- y: 300 - 100,
- w: 200,
- h: 200,
- type: 'svg',
- desc: {
- svg: '',
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/examples/idraw/features/lib/main.js b/examples/idraw/features/lib/main.js
deleted file mode 100644
index d2423b7..0000000
--- a/examples/idraw/features/lib/main.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import data from './data.js';
-import { doAction } from './action.js'
-
-const iDraw = window.iDraw;
-const mount = document.querySelector('#mount');
-
-const defaultConf = {
- scale: 2,
- scrollX: 0,
- scrollY: 0,
-}
-const idraw = new iDraw(mount, {
- width: 600,
- height: 400,
- contextWidth: 600,
- contextHeight: 400,
- devicePixelRatio: 4,
- disableKeyboard: false,
-});
-
-
-// idraw.on('error', (data) => {
-// console.log('error: ', data);
-// });
-// idraw.on('changeData', (data) => {
-// console.log('changeData: ', data);
-// });
-// idraw.on('changeScreen', (data) => {
-// console.log('changeScreen: ', data);
-// });
-// idraw.on('screenSelectElement', (data) => {
-// console.log('screenSelectElement: ', data);
-// });
-// idraw.on('screenMoveElementStart', (data) => {
-// console.log('screenMoveElementStart: ', data);
-// });
-// idraw.on('screenMoveElementEnd', (data) => {
-// console.log('screenMoveElementEnd: ', data);
-// });
-// idraw.on('screenChangeElement', (data) => {
-// console.log('screenChangeElement: ', data);
-// });
-
-
-idraw.setData(data, {
- triggerChangeEvent: true,
-});
-idraw.scale(2);
-doAction(idraw);
-
diff --git a/examples/idraw/features/main.html b/examples/idraw/features/main.html
deleted file mode 100644
index f7bac41..0000000
--- a/examples/idraw/features/main.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/idraw/react/demo.jsx b/examples/idraw/react/demo.jsx
deleted file mode 100644
index 83b1fd5..0000000
--- a/examples/idraw/react/demo.jsx
+++ /dev/null
@@ -1,33 +0,0 @@
-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 (
-
- )
-}
\ No newline at end of file
diff --git a/examples/idraw/test/api.html b/examples/idraw/test/api.html
deleted file mode 100644
index 89817d5..0000000
--- a/examples/idraw/test/api.html
+++ /dev/null
@@ -1,193 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
exportDataURL('image/png')
-
-
-
exportDataURL('image/jpeg')
-
-
-
toDataURL('image/png')
-
-
-
toDataURL('image/jpeg')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/idraw/vue/demo.vue b/examples/idraw/vue/demo.vue
deleted file mode 100644
index 114f9bc..0000000
--- a/examples/idraw/vue/demo.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/renderer/css/index.css b/examples/renderer/css/index.css
deleted file mode 100644
index 2b3f8f5..0000000
--- a/examples/renderer/css/index.css
+++ /dev/null
@@ -1,20 +0,0 @@
-html, body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- font-size: 12px;
- color: #333333;
-}
-
-#mount canvas {
- /* border-right: 1px solid #aaaaaa40; */
- border: 1px solid #aaaaaa2a;
- background-image:
- linear-gradient(#aaaaaa2a 1px, transparent 0),
- linear-gradient(90deg, #aaaaaa2a 1px, transparent 0),
- linear-gradient(#aaaaaa4a 1px, transparent 0),
- linear-gradient(90deg, #aaaaaa4a 1px, transparent 0);
- background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
-}
-
diff --git a/examples/renderer/lib/data/circle.js b/examples/renderer/lib/data/circle.js
deleted file mode 100644
index a934c9f..0000000
--- a/examples/renderer/lib/data/circle.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "circle-001",
- x: 10,
- y: 10,
- w: 100,
- h: 100,
- type: "circle",
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#999999',
-
- shadowColor: '#03a9f4',
- // shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- {
- name: "circle-002",
- x: 100,
- y: 80,
- w: 200,
- h: 100,
- angle: 30,
- type: "circle",
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#666666',
-
- },
- },
- {
- name: "circle-003",
- x: 200,
- y: 200,
- w: 200,
- h: 100,
- type: "circle",
- angle: 0,
- desc: {
- bgColor: "#f0f0f0",
- borderWidth: 2,
- borderColor: '#666666'
- },
- },
- {
- name: "circle-004",
- x: 220,
- y: 80,
- w: 300,
- h: 300,
- type: "circle",
- desc: {
- // bgColor: "#f0f0f0",
- bgColor: "#000000",
- borderWidth: 10,
- borderColor: '#666666',
-
- shadowColor: '#03a9f4',
- // shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/data/html.js b/examples/renderer/lib/data/html.js
deleted file mode 100644
index 8a87825..0000000
--- a/examples/renderer/lib/data/html.js
+++ /dev/null
@@ -1,91 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "html-001",
- x: 40,
- y: 40,
- w: 200,
- h: 70,
- type: "html",
- angle: 0,
- desc: {
- html: `
-
- Hello World!
-
-
-
- Hello World!
-
- `,
- },
- },
-
- {
- name: "html-001",
- x: 200,
- y: 120,
- w: 240,
- h: 240,
- type: "html",
- angle: 0,
- desc: {
- width: 120,
- height: 80,
- html: `
-
-
-
-
-
-
-
-
-
-
- `,
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/data/image.js b/examples/renderer/lib/data/image.js
deleted file mode 100644
index 00c0b5f..0000000
--- a/examples/renderer/lib/data/image.js
+++ /dev/null
@@ -1,83 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "image-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "image",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- // angle: 30,
- // angle: 0,
- desc: {
- src: "./../../../core/examples/images/computer.png",
- },
- },
- {
- name: "image-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- type: "image",
- desc: {
- src: "./../../../core/examples/images/chart.png",
- },
- },
- {
- name: "image-003",
- x: 160,
- y: 160,
- w: 200,
- h: 100,
- type: "image",
- angle: 45,
- desc: {
- src: "./../../../core/examples/images/phone.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 10,
- y: 300 - 10,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../../../core/examples/images/building-001.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 40,
- y: 300 - 40,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../../../core/examples/images/building-002.png",
- },
- },
- {
- name: "image-004",
- x: 400 - 100,
- y: 300 - 100,
- w: 100,
- h: 100,
- type: "image",
- desc: {
- src: "./../../../core/examples/images/building-003.png",
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/data/index.js b/examples/renderer/lib/data/index.js
deleted file mode 100644
index 4bd0982..0000000
--- a/examples/renderer/lib/data/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import dataRect from "./rect.js";
-import dataImage from "./image.js";
-import dataSVG from "./svg.js";
-import dataText from "./text.js";
-import dataCircle from "./circle.js";
-
-const url = new URLSearchParams(window.location.search);
-
-const dataMap = {
- rect: dataRect,
- image: dataImage,
- svg: dataSVG,
- text: dataText,
- circle: dataCircle,
-};
-
-export function getData() {
- return dataMap[getPageName()] || dataMap[url.get("data")] || dataMap["rect"];
-}
-
-function getPageName() {
- // const pathname = window.location.pathname || '';
- // const reg = /(?[\w+]{1,})\.html$/;
- // const page = reg.exec(pathname)?.groups?.pageName || '';
- // return page;
-
- const pathname = window.location.pathname || "";
- const list = pathname.split("/");
- let pageName = list.pop() || "";
- pageName = pageName.replace(/\.html$/gi, "");
- return pageName;
-
- // return getQueryString('data') || 'rect';
-}
-
-// function getQueryString(name) {
-// let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-// let r = window.location.search.substr(1).match(reg);
-// if (r != null) {
-// return decodeURIComponent(r[2]);
-// };
-// return null;
-// }
diff --git a/examples/renderer/lib/data/rect.js b/examples/renderer/lib/data/rect.js
deleted file mode 100644
index de3a42f..0000000
--- a/examples/renderer/lib/data/rect.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const data = {
- // bgColor: '#f0f0f0',
- elements: [
- {
- name: "rect-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "rect",
- desc: {
- bgColor: "#f0f0f0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- type: "rect",
- operation: {
- lock: true,
- },
- desc: {
- bgColor: "#cccccc",
- borderRadius: 60,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-003",
- x: 250,
- y: 150,
- w: 150,
- h: 20,
- type: "rect",
- angle: 45,
- desc: {
- bgColor: "#c0c0c0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- },
- {
- name: "rect-004",
- x: 400 - 50,
- y: 300 - 50,
- w: 200,
- h: 100,
- type: "rect",
- desc: {
- bgColor: "#e0e0e0",
- borderRadius: 20,
- borderWidth: 10,
- borderColor: "#bd0b64",
- },
- operation: {
- disbaleScale: true,
- disbaleRotate: true,
- }
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/data/svg.js b/examples/renderer/lib/data/svg.js
deleted file mode 100644
index 71a81e4..0000000
--- a/examples/renderer/lib/data/svg.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "svg-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "svg",
- // angle: 30,
- // angle: 0,
- desc: {
- svg: ``,
- },
- },
- {
- name: "svg-002",
- x: 80,
- y: 80,
- w: 200,
- h: 120,
- // angle: 30,
- type: "svg",
- desc: {
- svg: '',
- },
- },
- {
- name: "svg-003",
- x: 160,
- y: 160,
- w: 200,
- h: 200,
- type: "svg",
- angle: 80,
- desc: {
- svg: '',
- },
- },
- {
- name: "svg-004",
- x: 400 - 10,
- y: 300 - 100,
- w: 200,
- h: 200,
- type: "svg",
- desc: {
- svg: '',
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/data/text.js b/examples/renderer/lib/data/text.js
deleted file mode 100644
index 3a6b0a9..0000000
--- a/examples/renderer/lib/data/text.js
+++ /dev/null
@@ -1,99 +0,0 @@
-const data = {
- // bgColor: '#ffffff',
- elements: [
- {
- name: "text-001",
- x: 10,
- y: 10,
- w: 200,
- h: 100,
- type: "text",
- desc: {
- fontSize: 20,
- color: "#ffffff",
- text: "生活就像海洋,只有意志坚强的人,才能到达彼岸。",
- fontFamily: '',
- fontWeight: 'bold',
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- strokeColor: '#2196f3',
- strokeWidth: 1,
- },
- },
- {
- name: "text-002",
- x: 120,
- y: 120,
- w: 100,
- h: 60,
- // angle: 30,
- type: "text",
- desc: {
- fontSize: 40,
- fontWeight: 'blod',
- text: "Hello Text",
- // color: "#999999",
- color: "#ffffff",
- borderRadius: 60,
- borderWidth: 4,
- borderColor: "#03a9f4",
-
- textShadowColor: '#000000',
- textShadowOffsetX: 2,
- textShadowOffsetY: 2,
- textShadowBlur: 2,
-
- shadowColor: '#000000',
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- shadowBlur: 2,
- },
- },
- {
- name: "text-003",
- x: 160,
- y: 160,
- w: 200,
- h: 100,
- type: "text",
- operation: {
- invisible: true,
- lock: true,
- },
- desc: {
- fontSize: 20,
- color: "#333333",
- text: "生活就像海洋,只有意志坚强的人,才能到达彼岸。",
- fontFamily: "",
- textAlign: "right",
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- },
- },
- {
- name: "text-004",
- x: 300,
- y: 240,
- w: 290,
- h: 120,
- type: "text",
- desc: {
- fontSize: 20,
- color: "#333333",
- text: "Life is like an ocean.\r\nOnly those with strong \nwill can reach the other shore.",
- fontFamily: "",
- textAlign: "right",
- borderRadius: 20,
- borderWidth: 2,
- borderColor: "#03a9f4",
- bgColor: '#f0f0f0',
- },
- },
- ],
-};
-
-export default data;
diff --git a/examples/renderer/lib/main.js b/examples/renderer/lib/main.js
deleted file mode 100644
index f025297..0000000
--- a/examples/renderer/lib/main.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import { getData } from './data/index.js';
-// import util from './../../../node_modules/@idraw/util/dist/index.es.js'
-// import util from './../../../../util/dist/index.es.js'
-
-// const Context = util.Context;
-const Context = iDrawUtil.Context;
-const { Renderer } = window.iDrawRenderer;
-const data = getData();
-const canvas = document.querySelector('#canvas');
-const opts = {
- width: 600,
- height: 400,
- contextWidth: 600,
- contextHeight: 400,
- devicePixelRatio: 1,
- // devicePixelRatio: 2,
- // onlyRender: true,
-}
-
-const renderer = new Renderer(opts);
-
-renderer.on('load', (e) => {
- console.log('load =', e)
-})
-renderer.on('loadComplete', (e) => {
- console.log('loadComplete =', e)
-})
-
-renderer.on('drawFrame', (e) => {
- console.log('drawFrame =', e)
-})
-renderer.on('drawFrameComplete', (e) => {
- console.log('drawFrameComplete =', e)
-})
-
-// renderer.render(canvas, data)
-// renderer.render(canvas, { elements: data.elements.splice(1, 2) }, { forceUpdate: false })
-// console.log(renderer.getContext())
-
-
-canvas.width = opts.width * opts.devicePixelRatio;
-canvas.height = opts.height * opts.devicePixelRatio;
-const ctx = new Context(canvas.getContext('2d'), opts)
-renderer.render(ctx, data);
-renderer.render(ctx, { elements: data.elements.splice(1, 2) }, { forceUpdate: false })
-
-
diff --git a/examples/renderer/main.html b/examples/renderer/main.html
deleted file mode 100644
index 1c9327f..0000000
--- a/examples/renderer/main.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file