revert perf fix

This commit is contained in:
Anton Lavrenov 2020-09-14 14:30:03 -05:00
parent 9bd68eacf1
commit fa33896e6b
6 changed files with 1344 additions and 68 deletions

View File

@ -3,7 +3,8 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
* Some performance fixes and optimizations ## 7.1.1
* fixes for `dragstart` event when `Konva.Transformer` is used. `dragstart` event will have correct native `evt` reference * fixes for `dragstart` event when `Konva.Transformer` is used. `dragstart` event will have correct native `evt` reference
* Better unicode support in `Konva.Text` and `Konva.TextPath`. Emoji should work better now 👍 * Better unicode support in `Konva.Text` and `Konva.TextPath`. Emoji should work better now 👍

1384
konva.js

File diff suppressed because it is too large Load Diff

2
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -722,7 +722,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
evtStr: K, evtStr: K,
handler: KonvaEventListener<this, NodeEventMap[K]> handler: KonvaEventListener<this, NodeEventMap[K]>
) { ) {
this._cache && this._cache.delete(ALL_LISTENERS); // this._cache && this._cache.delete(ALL_LISTENERS);
if (arguments.length === 3) { if (arguments.length === 3) {
return this._delegate.apply(this, arguments); return this._delegate.apply(this, arguments);
} }
@ -2279,10 +2279,10 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
} }
_getListeners(eventType) { _getListeners(eventType) {
const events = this._cache.get(ALL_LISTENERS); // const events = this._cache.get(ALL_LISTENERS);
if (events) { // if (events && events[eventType]) {
return events; // return events[eventType];
} // }
let totalEvents = []; let totalEvents = [];
let obj; let obj;
@ -2301,7 +2301,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
totalEvents = events.concat(totalEvents); totalEvents = events.concat(totalEvents);
obj = Object.getPrototypeOf(obj); obj = Object.getPrototypeOf(obj);
} }
this._cache.set(ALL_LISTENERS, totalEvents); // this._cache.set(ALL_LISTENERS, totalEvents);
return totalEvents; return totalEvents;
} }
_fire(eventType, evt) { _fire(eventType, evt) {

View File

@ -11,7 +11,7 @@
<body> <body>
<div id="container"></div> <div id="container"></div>
<script src="../../konva.js"></script> <script src="../../konva.js"></script>
<!-- <script src="https://unpkg.com/konva@6.0.0/konva.min.js"></script> --> <!-- <script src="https://unpkg.com/konva@^7/konva.min.js"></script> -->
<script src="http://www.html5canvastutorials.com/lib/stats/stats.js"></script> <script src="http://www.html5canvastutorials.com/lib/stats/stats.js"></script>
<script defer="defer"> <script defer="defer">
var lastTime = 0; var lastTime = 0;
@ -78,12 +78,14 @@
document.addEventListener('touchend', onTouchEnd, true); document.addEventListener('touchend', onTouchEnd, true);
function createShape() { function createShape() {
return new Konva.Circle({ return new Konva.Rect({
transformsEnabled: 'position', transformsEnabled: 'position',
x: 10, x: 10,
y: 10, y: 10,
perfectDrawEnabled: false, perfectDrawEnabled: false,
radius: 10, // radius: 10,
width: 10,
height: 10,
fill: Konva.Util.getRandomColor(), fill: Konva.Util.getRandomColor(),
}); });
} }

View File

@ -1,4 +1,4 @@
suite('Stage', function () { suite.only('Stage', function () {
// ====================================================== // ======================================================
test('instantiate stage with id', function () { test('instantiate stage with id', function () {
var container = Konva.document.createElement('div'); var container = Konva.document.createElement('div');
@ -828,7 +828,6 @@ suite('Stage', function () {
var clicks = 0; var clicks = 0;
stage.on('click', function () { stage.on('click', function () {
debugger;
clicks += 1; clicks += 1;
}); });