fix fail on empty config

This commit is contained in:
Anton Lavrenov 2018-02-22 09:17:08 +08:00
parent 9a46ca6176
commit 739be29ea0
3 changed files with 307 additions and 307 deletions

View File

@ -2,7 +2,7 @@
* Konva JavaScript Framework v1.7.6
* http://konvajs.github.io/
* Licensed under the MIT
* Date: Sun Feb 18 2018
* Date: Thu Feb 22 2018
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@ -16713,7 +16713,7 @@
var that = this;
this.dummyCanvas = Konva.Util.createCanvasElement();
this.dataArray = [];
this.getKerning = config.getKerning;
this.getKerning = config && config.getKerning;
// call super constructor
Konva.Shape.call(this, config);
@ -17101,9 +17101,9 @@
if (this.getKerning) {
try {
// getKerning is a user provided getter. Make sure it never breaks our logic
kern = this.getKerning(charArr[i - 1], charArr[i]) * this.fontSize();
}
catch(e) {
kern =
this.getKerning(charArr[i - 1], charArr[i]) * this.fontSize();
} catch (e) {
kern = 0;
}
}

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -63,7 +63,7 @@
var that = this;
this.dummyCanvas = Konva.Util.createCanvasElement();
this.dataArray = [];
this.getKerning = config.getKerning;
this.getKerning = config && config.getKerning;
// call super constructor
Konva.Shape.call(this, config);
@ -451,9 +451,9 @@
if (this.getKerning) {
try {
// getKerning is a user provided getter. Make sure it never breaks our logic
kern = this.getKerning(charArr[i - 1], charArr[i]) * this.fontSize();
}
catch(e) {
kern =
this.getKerning(charArr[i - 1], charArr[i]) * this.fontSize();
} catch (e) {
kern = 0;
}
}