mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 01:31:01 +08:00
small rename
This commit is contained in:
parent
2466ea61b0
commit
2f156de78d
@ -181,9 +181,9 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
find: function(selector) {
|
find: function(selector) {
|
||||||
// protecting _findByType to prevent user from accidentally adding
|
// protecting _generalFind to prevent user from accidentally adding
|
||||||
// second argument and getting unexpected `findOne` result
|
// second argument and getting unexpected `findOne` result
|
||||||
return this._findByType(selector, false);
|
return this._generalFind(selector, false);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* return a first node from `find` method
|
* return a first node from `find` method
|
||||||
@ -204,10 +204,10 @@
|
|||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
findOne: function(selector) {
|
findOne: function(selector) {
|
||||||
var result = this._findByType(selector, true);
|
var result = this._generalFind(selector, true);
|
||||||
return result.length > 0 ? result[0] : undefined;
|
return result.length > 0 ? result[0] : undefined;
|
||||||
},
|
},
|
||||||
_findByType: function(selector, findOne) {
|
_generalFind: function(selector, findOne) {
|
||||||
var retArr = [];
|
var retArr = [];
|
||||||
|
|
||||||
if (typeof selector === 'string') {
|
if (typeof selector === 'string') {
|
||||||
|
@ -363,14 +363,14 @@
|
|||||||
var lineWidth = this._getTextWidth(line);
|
var lineWidth = this._getTextWidth(line);
|
||||||
if (fixedWidth && lineWidth > maxWidth) {
|
if (fixedWidth && lineWidth > maxWidth) {
|
||||||
/*
|
/*
|
||||||
* if width is fixed and line does not fit entirely
|
* if width is fixed and line does not fit entirely
|
||||||
* break the line into multiple fitting lines
|
* break the line into multiple fitting lines
|
||||||
*/
|
*/
|
||||||
while (line.length > 0) {
|
while (line.length > 0) {
|
||||||
/*
|
/*
|
||||||
* use binary search to find the longest substring that
|
* use binary search to find the longest substring that
|
||||||
* that would fit in the specified width
|
* that would fit in the specified width
|
||||||
*/
|
*/
|
||||||
var low = 0,
|
var low = 0,
|
||||||
high = line.length,
|
high = line.length,
|
||||||
match = '',
|
match = '',
|
||||||
@ -414,9 +414,9 @@
|
|||||||
(fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx)
|
(fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx)
|
||||||
) {
|
) {
|
||||||
/*
|
/*
|
||||||
* stop wrapping if wrapping is disabled or if adding
|
* stop wrapping if wrapping is disabled or if adding
|
||||||
* one more line would overflow the fixed height
|
* one more line would overflow the fixed height
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
line = line.slice(low);
|
line = line.slice(low);
|
||||||
|
Loading…
Reference in New Issue
Block a user