remove inherit from listening property, deprecate FastLayer, font fixes.

This commit is contained in:
Anton Lavrenov
2020-05-14 11:13:47 -05:00
parent 6cc3224769
commit ee99044baa
23 changed files with 17529 additions and 18942 deletions

View File

@@ -28,7 +28,7 @@
var maxY = height - 10;
var minY = 0;
var startBunnyCount = 1000;
var startBunnyCount = 2000;
var isAdding = false;
var count = 0;
var container;
@@ -40,14 +40,14 @@
var stage = new Konva.Stage({
container: 'container',
width: width - 10,
height: height - 10
height: height - 10,
});
layer = new Konva.FastLayer();
layer = new Konva.Layer({ listening: false });
stage.add(layer);
stats = new Stats();
wabbitTexture = new Image();
wabbitTexture.onload = function() {
wabbitTexture.onload = function () {
_handleTextureLoaded();
};
wabbitTexture.src = '../assets/bunny.png';
@@ -71,11 +71,11 @@
container = stage;
// stage.addChild(container);
stage.on('mousedown', function() {
stage.on('mousedown', function () {
isAdding = true;
});
stage.on('mouseup', function() {
stage.on('mouseup', function () {
isAdding = false;
});
@@ -87,9 +87,8 @@
var bunny = new Konva.Image({
image: wabbitTexture,
transformsEnabled: 'position',
hitGraphEnabled: false,
x: 10,
y: 10
y: 10,
});
bunny.speedX = Math.random() * 10;
@@ -97,8 +96,6 @@
bunnys.push(bunny);
layer.add(bunny);
}
layer.draw();
}
@@ -121,7 +118,7 @@
image: wabbitTexture,
transformsEnabled: 'position',
x: 0,
y: 0
y: 0,
});
bunny.speedX = Math.random() * 10;
bunny.speedY = Math.random() * 10 - 5;
@@ -157,7 +154,7 @@
bunny.setY(minY);
}
}
layer.drawScene();
layer.draw();
requestAnimationFrame(update);
stats.end();
}