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

View File

@ -11,7 +11,7 @@
<body>
<div id="container"></div>
<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 defer="defer">
var lastTime = 0;
@ -78,12 +78,14 @@
document.addEventListener('touchend', onTouchEnd, true);
function createShape() {
return new Konva.Circle({
return new Konva.Rect({
transformsEnabled: 'position',
x: 10,
y: 10,
perfectDrawEnabled: false,
radius: 10,
// radius: 10,
width: 10,
height: 10,
fill: Konva.Util.getRandomColor(),
});
}

View File

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