idraw/packages/core/dev/main.js

39 lines
651 B
JavaScript
Raw Permalink Normal View History

2022-12-31 15:21:57 +00:00
import Core from './../src/index';
2022-01-03 09:31:28 +00:00
import { getData } from './data.js';
2022-01-03 08:50:03 +00:00
2022-12-31 15:21:57 +00:00
console.log('Core =', Core);
2022-01-03 09:31:28 +00:00
var opts = {
width: 300,
height: 200,
contextWidth: 300,
contextHeight: 200,
2022-12-31 15:21:57 +00:00
devicePixelRatio: 4
};
2022-01-03 09:31:28 +00:00
// var config = {
// elementWrapper: {
// controllerSize: 4,
// }
// }
2022-01-03 08:50:03 +00:00
const mount = document.querySelector('#mount');
const data = getData();
const core = new Core(
mount,
Object.assign({}, opts, {
contextWidth: 500,
2022-12-31 15:21:57 +00:00
contextHeight: 400
2022-01-03 08:50:03 +00:00
}),
{
scrollWrapper: {
2022-12-31 15:21:57 +00:00
use: true
}
2022-01-03 08:50:03 +00:00
}
);
core.setData(data);
const elem1 = core.getData().elements[1];
elem1.desc.text = 'Updated';
core.updateElement(elem1);