2018-11-07 19:31:50 +08:00

55 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>01 DomTest</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body>
<script src="../dist/ShadowEditor.SVG.js"></script>
<script>
function CustomControl(options = {}) {
Shadow.SvgControl.call(this, options);
}
CustomControl.prototype = Object.create(Shadow.SvgControl.prototype);
CustomControl.prototype.constructor = CustomControl;
CustomControl.prototype.render = function () {
this.renderDom(this.createElement('circle'));
};
var dom = Shadow.SVG.create({
xtype: 'dom',
parent: document.body,
attr: {
width: 800,
height: 600,
},
children: [
new CustomControl({
attr: {
cx: 80,
cy: 80,
r: 50,
stroke: '#555',
'stroke-width': 2,
fill: '#f00'
},
listeners: {
click: () => {
alert('You clicked!');
}
}
})
]
});
dom.render();
</script>
</body>
</html>