1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Drag on Object with Origin</title>
<script src="../dist/zrender.js"></script>
</head>
<body>
<div id="main" style="width:1000px;height:500px;"></div>
<script type="text/javascript">
var zr = zrender.init(document.getElementById('main'));
const image = new zrender.Image({
draggable: true,
rotation: 2,
origin: [50, 50],
style: {
image: './asset/test.png',
height: 100,
width: 100
}
})
const group = new zrender.Group({
position: [100, 100]
})
const image2 = new zrender.Image({
draggable: true,
rotation: 2,
origin: [50, 50],
style: {
image: './test.png',
height: 100,
width: 100
}
})
zr.add(image);
zr.add(group);
group.add(image2);
</script>
</body>
</html>
|