mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 15:20:56 +08:00
51 lines
862 B
HTML
51 lines
862 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
background-color: #F0F0F0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container"></div>
|
|
<script src="../dist/konva-dev.js"></script>
|
|
|
|
<script>
|
|
// Code goes here
|
|
|
|
|
|
var width = window.innerWidth;
|
|
var height = window.innerHeight;
|
|
|
|
var stage = new Konva.Stage({
|
|
container: 'container',
|
|
width: width,
|
|
height: height
|
|
});
|
|
|
|
var layer = new Konva.Layer();
|
|
layer.add(new Konva.Rect({
|
|
width: 100,
|
|
height: 100,
|
|
fill: 'red'
|
|
}))
|
|
stage.add(layer);
|
|
|
|
// stage.getContent().addEventListener('contextmenu', function(e) {
|
|
//
|
|
// console.log('menu');
|
|
// e.preventDefault();
|
|
// return false;
|
|
// });
|
|
stage.on('contentContextmenu', function(e) {
|
|
console.log(e.evt.preventDefault());
|
|
console.log('context click');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|