2021-06-04 06:43:42 +00:00
|
|
|
import { getData } from './data/index.js';
|
|
|
|
|
import { doScale } from './scale.js';
|
|
|
|
|
import { doScroll } from './scroll.js';
|
|
|
|
|
import { doElemens } from './element.js';
|
2021-05-26 07:21:27 +00:00
|
|
|
|
2022-02-27 13:17:42 +00:00
|
|
|
const { Core } = window.iDrawCore;
|
2021-06-02 06:10:45 +00:00
|
|
|
const data = getData();
|
2021-05-25 14:56:42 +00:00
|
|
|
const mount = document.querySelector('#mount');
|
2021-05-27 07:39:55 +00:00
|
|
|
|
2021-05-26 07:21:27 +00:00
|
|
|
const defaultConf = {
|
2021-08-20 03:32:07 +00:00
|
|
|
// scale: 1.5,
|
|
|
|
|
// scrollLeft: 100,
|
|
|
|
|
// scrollTop: 50,
|
|
|
|
|
|
|
|
|
|
scale: 0,
|
|
|
|
|
scrollLeft: 0,
|
|
|
|
|
scrollTop: 0,
|
2021-07-09 10:19:10 +00:00
|
|
|
};
|
2021-05-25 14:56:42 +00:00
|
|
|
const core = new Core(mount, {
|
|
|
|
|
width: 600,
|
|
|
|
|
height: 400,
|
2021-06-07 06:21:30 +00:00
|
|
|
contextWidth: 600,
|
|
|
|
|
contextHeight: 400,
|
2021-06-18 11:11:55 +00:00
|
|
|
devicePixelRatio: 4,
|
2021-08-11 14:31:43 +00:00
|
|
|
// onlyRender: true,
|
2021-06-18 11:11:55 +00:00
|
|
|
}, {
|
|
|
|
|
scrollWrapper: {
|
|
|
|
|
use: true,
|
2021-07-29 11:17:52 +00:00
|
|
|
lineWidth: 16,
|
|
|
|
|
color: '#9c27b0',
|
|
|
|
|
},
|
|
|
|
|
elementWrapper: {
|
|
|
|
|
lockColor: '#009688',
|
2021-12-11 02:57:10 +00:00
|
|
|
color: '#009688',
|
2021-10-24 07:35:12 +00:00
|
|
|
controllerSize: 6,
|
2021-07-29 11:17:52 +00:00
|
|
|
lineWidth: 1,
|
2021-09-26 14:27:39 +00:00
|
|
|
// lineDash: [12, 12],
|
2021-07-29 11:17:52 +00:00
|
|
|
},
|
2021-05-25 14:56:42 +00:00
|
|
|
});
|
2021-05-28 05:44:26 +00:00
|
|
|
|
|
|
|
|
|
2021-09-14 03:09:46 +00:00
|
|
|
// initEvent();
|
2021-06-05 06:36:32 +00:00
|
|
|
|
2021-05-25 14:56:42 +00:00
|
|
|
core.setData(data);
|
2021-06-04 06:43:42 +00:00
|
|
|
|
2021-05-26 07:21:27 +00:00
|
|
|
doScale(core, defaultConf.scale);
|
|
|
|
|
doScroll(core, defaultConf);
|
2021-05-28 04:25:41 +00:00
|
|
|
doElemens(core);
|
2021-06-04 06:43:42 +00:00
|
|
|
|
2021-08-11 14:31:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
});
|
2021-08-22 08:27:54 +00:00
|
|
|
core.on('screenDoubleClickElement', (p) => {
|
|
|
|
|
console.log('screenDoubleClickElement ===', p)
|
|
|
|
|
})
|
2021-09-24 15:11:41 +00:00
|
|
|
core.on('drawFrame', () => {
|
|
|
|
|
console.log(' === drawFrame === ')
|
|
|
|
|
})
|
|
|
|
|
core.on('drawFrameComplete', () => {
|
|
|
|
|
console.log(' === drawFrameComplete === ')
|
|
|
|
|
})
|
2021-08-11 14:31:43 +00:00
|
|
|
|
2021-09-14 03:09:46 +00:00
|
|
|
}
|
|
|
|
|
|