clean files

This commit is contained in:
Anton Lavrenov 2020-06-19 10:36:12 -05:00
parent f664606b8f
commit bc4bfbc0c5
4 changed files with 46 additions and 1430 deletions

1364
konva.js

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
},
"size-limit": [
{
"limit": "45 KB",
"limit": "47 KB",
"path": "./lib/index.js"
},
{

View File

@ -1,74 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
canvas {
border: 1px solid #9C9898;
}
</style>
</head>
<body>
<div id="container"></div>
<script src="../../dist/konva-dev.js"></script>
<script>
var stage = new Konva.Stage({
container: 'container',
width: 500,
height: 250
});
var layer = new Konva.Layer();
for (var j = 0; j < 20; j++) {
layer.add(new Konva.Circle({
x: stage.width() * Math.random(),
y: stage.height() * Math.random(),
radius: 50,
stroke: 'black',
fill: Konva.Util.getRandomColor(),
strokeWidth: 5,
draggable: true
}));
}
stage.add(layer);
var i, count = 500, start;
var start = Date.now();
for (i = 0; i < count; i++) {
layer.draw();
}
var defTime = Date.now() - start;
layer.getHitCanvas().setPixelRatio(1);
// layer.getCanvas().setPixelRatio(1);
layer.draw();
start = Date.now();
for (i = 0; i < count; i++) {
layer.draw();
}
var time1 = Date.now() - start;
layer.getHitCanvas().setPixelRatio(0.2);
// layer.getCanvas().setPixelRatio(0.5);
layer.draw();
start = Date.now();
for (i = 0; i < count; i++) {
layer.draw();
}
var time05 = Date.now() - start;
console.log('def ' + defTime + ', 1 ration ' + time1 + ', 05 ration ' + time05)
</script>
</body>
</html>

View File

@ -1,36 +0,0 @@
Konva.WebGLLayer = function (config) {
this.nodeType = 'Layer';
this.canvas = new Konva.SceneWebGLCanvas();
this.hitCanvas = new Konva.HitCanvas({
pixelRatio: 1,
});
// call super constructor
Konva.BaseLayer.call(this, config);
};
Konva.Util.extend(Konva.WebGLLayer, Konva.Layer);
Konva.SceneWebGLCanvas = function (config) {
var conf = config || {};
var width = conf.width || 0,
height = conf.height || 0;
Konva.Canvas.call(this, conf);
WebGL2D.enable(this._canvas);
this.context = new Konva.SceneWebGLContext(this);
this.setSize(width, height);
};
Konva.Util.extend(Konva.SceneWebGLCanvas, Konva.SceneCanvas);
Konva.SceneWebGLContext = function (canvas) {
this.canvas = canvas;
this._context = canvas._canvas.getContext('webgl-2d');
if (Konva.enableTrace) {
this.traceArr = [];
this._enableTrace();
}
};
Konva.Util.extend(Konva.SceneWebGLContext, Konva.SceneContext);