mirror of
https://github.com/konvajs/konva.git
synced 2025-10-14 11:44:55 +08:00
cleaned up jshint errors in Image.js
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
"quotmark": "single",
|
"quotmark": "single",
|
||||||
"unused": true,
|
"unused": true,
|
||||||
"globals": {
|
"globals": {
|
||||||
"Kinetic": false
|
"Kinetic": false,
|
||||||
|
"document": false
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -8,10 +8,8 @@
|
|||||||
DASH = '-',
|
DASH = '-',
|
||||||
EMPTY_STRING = '',
|
EMPTY_STRING = '',
|
||||||
LEFT = 'left',
|
LEFT = 'left',
|
||||||
NEW_LINE = '\n',
|
|
||||||
TEXT = 'text',
|
TEXT = 'text',
|
||||||
TEXT_UPPER = 'Text',
|
TEXT_UPPER = 'Text',
|
||||||
TOP = 'top',
|
|
||||||
MIDDLE = 'middle',
|
MIDDLE = 'middle',
|
||||||
NORMAL = 'normal',
|
NORMAL = 'normal',
|
||||||
PX_SPACE = 'px ',
|
PX_SPACE = 'px ',
|
||||||
@@ -91,14 +89,12 @@
|
|||||||
},
|
},
|
||||||
drawFunc: function(context) {
|
drawFunc: function(context) {
|
||||||
var p = this.getPadding(),
|
var p = this.getPadding(),
|
||||||
fontStyle = this.getFontStyle(),
|
|
||||||
fontSize = this.getFontSize(),
|
|
||||||
fontFamily = this.getFontFamily(),
|
|
||||||
textHeight = this.getTextHeight(),
|
textHeight = this.getTextHeight(),
|
||||||
lineHeightPx = this.getLineHeight() * textHeight,
|
lineHeightPx = this.getLineHeight() * textHeight,
|
||||||
textArr = this.textArr,
|
textArr = this.textArr,
|
||||||
textArrLen = textArr.length,
|
textArrLen = textArr.length,
|
||||||
totalWidth = this.getWidth();
|
totalWidth = this.getWidth(),
|
||||||
|
n;
|
||||||
|
|
||||||
context.setAttr('font', this._getContextFont());
|
context.setAttr('font', this._getContextFont());
|
||||||
context.setAttr('textBaseline', MIDDLE);
|
context.setAttr('textBaseline', MIDDLE);
|
||||||
@@ -108,7 +104,7 @@
|
|||||||
context.translate(0, p + textHeight / 2);
|
context.translate(0, p + textHeight / 2);
|
||||||
|
|
||||||
// draw text lines
|
// draw text lines
|
||||||
for(var n = 0; n < textArrLen; n++) {
|
for(n = 0; n < textArrLen; n++) {
|
||||||
var obj = textArr[n],
|
var obj = textArr[n],
|
||||||
text = obj.text,
|
text = obj.text,
|
||||||
width = obj.width;
|
width = obj.width;
|
||||||
@@ -202,7 +198,7 @@
|
|||||||
_getContextFont: function() {
|
_getContextFont: function() {
|
||||||
return this.getFontStyle() + SPACE + this.getFontSize() + PX_SPACE + this.getFontFamily();
|
return this.getFontStyle() + SPACE + this.getFontSize() + PX_SPACE + this.getFontFamily();
|
||||||
},
|
},
|
||||||
_addTextLine: function (line, width, height) {
|
_addTextLine: function (line, width) {
|
||||||
return this.textArr.push({text: line, width: width});
|
return this.textArr.push({text: line, width: width});
|
||||||
},
|
},
|
||||||
_getTextWidth: function (text) {
|
_getTextWidth: function (text) {
|
||||||
|
Reference in New Issue
Block a user