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