mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
remove inherit
from listening property, deprecate FastLayer, font fixes.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user