mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 11:42:17 +08:00
Use custom functions for trimRight
and trimLeft
(for better browsers support)
This commit is contained in:
parent
16caf0ae9d
commit
b085ece741
@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [new version][unreleased]
|
## [new version][unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* Use custom functions for `trimRight` and `trimLeft` (for better browsers support)
|
||||||
|
|
||||||
## [2.5.0][2018-10-24]
|
## [2.5.0][2018-10-24]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -12,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
* New `anchorCornerRadius` for `Konva.Transformer`
|
* New `anchorCornerRadius` for `Konva.Transformer`
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* Performance fixes for caching
|
* Performance fixes for caching
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
12
konva.js
12
konva.js
@ -2,7 +2,7 @@
|
|||||||
* Konva JavaScript Framework v2.5.0
|
* Konva JavaScript Framework v2.5.0
|
||||||
* http://konvajs.github.io/
|
* http://konvajs.github.io/
|
||||||
* Licensed under the MIT
|
* Licensed under the MIT
|
||||||
* Date: Wed Oct 24 2018
|
* Date: Thu Nov 08 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)
|
||||||
@ -1024,6 +1024,12 @@
|
|||||||
}
|
}
|
||||||
return retObj;
|
return retObj;
|
||||||
},
|
},
|
||||||
|
trimRight: function(str) {
|
||||||
|
return str.replace(/\s+$/, "");
|
||||||
|
},
|
||||||
|
trimLeft: function(str) {
|
||||||
|
return str.replace(/^\s+/, "");
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* check intersection of two client rectangles
|
* check intersection of two client rectangles
|
||||||
* @method
|
* @method
|
||||||
@ -15519,7 +15525,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (align === 'right') {
|
// if (align === 'right') {
|
||||||
match = match.trimRight();
|
match = Konva.Util.trimRight(match);
|
||||||
// }
|
// }
|
||||||
this._addTextLine(match);
|
this._addTextLine(match);
|
||||||
textWidth = Math.max(textWidth, matchWidth);
|
textWidth = Math.max(textWidth, matchWidth);
|
||||||
@ -15535,7 +15541,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
line = line.slice(low);
|
line = line.slice(low);
|
||||||
line = line.trimLeft();
|
line = Konva.Util.trimLeft(line);
|
||||||
if (line.length > 0) {
|
if (line.length > 0) {
|
||||||
// Check if the remaining text would fit on one line
|
// Check if the remaining text would fit on one line
|
||||||
lineWidth = this._getTextWidth(line);
|
lineWidth = this._getTextWidth(line);
|
||||||
|
6
konva.min.js
vendored
6
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -764,6 +764,12 @@
|
|||||||
}
|
}
|
||||||
return retObj;
|
return retObj;
|
||||||
},
|
},
|
||||||
|
trimRight: function(str) {
|
||||||
|
return str.replace(/\s+$/, "");
|
||||||
|
},
|
||||||
|
trimLeft: function(str) {
|
||||||
|
return str.replace(/^\s+/, "");
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* check intersection of two client rectangles
|
* check intersection of two client rectangles
|
||||||
* @method
|
* @method
|
||||||
|
@ -440,7 +440,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (align === 'right') {
|
// if (align === 'right') {
|
||||||
match = match.trimRight();
|
match = Konva.Util.trimRight(match);
|
||||||
// }
|
// }
|
||||||
this._addTextLine(match);
|
this._addTextLine(match);
|
||||||
textWidth = Math.max(textWidth, matchWidth);
|
textWidth = Math.max(textWidth, matchWidth);
|
||||||
@ -456,7 +456,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
line = line.slice(low);
|
line = line.slice(low);
|
||||||
line = line.trimLeft();
|
line = Konva.Util.trimLeft(line);
|
||||||
if (line.length > 0) {
|
if (line.length > 0) {
|
||||||
// Check if the remaining text would fit on one line
|
// Check if the remaining text would fit on one line
|
||||||
lineWidth = this._getTextWidth(line);
|
lineWidth = this._getTextWidth(line);
|
||||||
|
Loading…
Reference in New Issue
Block a user