mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-23 23:34:41 +00:00
Build dist
This commit is contained in:
parent
a11e69de47
commit
29f9033c96
4 changed files with 111 additions and 55 deletions
80
dist/fabric.js
vendored
80
dist/fabric.js
vendored
|
|
@ -14422,6 +14422,10 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
q: 4,
|
||||
t: 2,
|
||||
a: 7
|
||||
},
|
||||
repeatedCommands = {
|
||||
m: 'l',
|
||||
M: 'L'
|
||||
};
|
||||
|
||||
if (fabric.Path) {
|
||||
|
|
@ -14567,8 +14571,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
tempControlX,
|
||||
tempControlY,
|
||||
l = -((this.width / 2) + this.pathOffset.x),
|
||||
t = -((this.height / 2) + this.pathOffset.y),
|
||||
methodName;
|
||||
t = -((this.height / 2) + this.pathOffset.y);
|
||||
|
||||
for (var i = 0, len = this.path.length; i < len; ++i) {
|
||||
|
||||
|
|
@ -14611,21 +14614,13 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
case 'm': // moveTo, relative
|
||||
x += current[1];
|
||||
y += current[2];
|
||||
// draw a line if previous command was moveTo as well (otherwise, it will have no effect)
|
||||
methodName = (previous && (previous[0] === 'm' || previous[0] === 'M'))
|
||||
? 'lineTo'
|
||||
: 'moveTo';
|
||||
ctx[methodName](x + l, y + t);
|
||||
ctx.moveTo(x + l, y + t);
|
||||
break;
|
||||
|
||||
case 'M': // moveTo, absolute
|
||||
x = current[1];
|
||||
y = current[2];
|
||||
// draw a line if previous command was moveTo as well (otherwise, it will have no effect)
|
||||
methodName = (previous && (previous[0] === 'm' || previous[0] === 'M'))
|
||||
? 'lineTo'
|
||||
: 'moveTo';
|
||||
ctx[methodName](x + l, y + t);
|
||||
ctx.moveTo(x + l, y + t);
|
||||
break;
|
||||
|
||||
case 'c': // bezierCurveTo, relative
|
||||
|
|
@ -14990,12 +14985,14 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
}
|
||||
}
|
||||
|
||||
var command = coordsParsed[0].toLowerCase(),
|
||||
commandLength = commandLengths[command];
|
||||
var command = coordsParsed[0],
|
||||
commandLength = commandLengths[command.toLowerCase()],
|
||||
repeatedCommand = repeatedCommands[command] || command;
|
||||
|
||||
if (coordsParsed.length - 1 > commandLength) {
|
||||
for (var k = 1, klen = coordsParsed.length; k < klen; k += commandLength) {
|
||||
result.push([ coordsParsed[0] ].concat(coordsParsed.slice(k, k + commandLength)));
|
||||
result.push([ command ].concat(coordsParsed.slice(k, k + commandLength)));
|
||||
command = repeatedCommand;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -20773,6 +20770,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.__lastClickTime = this.__newClickTime;
|
||||
this.__lastPointer = newPointer;
|
||||
this.__lastIsEditing = this.isEditing;
|
||||
this.__lastSelected = this.selected;
|
||||
},
|
||||
|
||||
isDoubleClick: function(newPointer) {
|
||||
|
|
@ -20884,7 +20882,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.__isMousedown = false;
|
||||
if (this._isObjectMoved(options.e)) return;
|
||||
|
||||
if (this.selected) {
|
||||
if (this.__lastSelected) {
|
||||
this.enterEditing();
|
||||
this.initDelayedCursor(true);
|
||||
}
|
||||
|
|
@ -21032,6 +21030,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keydown', this.onKeyDown.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keypress', this.onKeyPress.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'copy', this.copy.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'paste', this.paste.bind(this));
|
||||
|
||||
|
||||
if (!this._clickHandlerInitialized && this.canvas) {
|
||||
fabric.util.addListener(this.canvas.upperCanvasEl, 'click', this.onClick.bind(this));
|
||||
|
|
@ -21057,8 +21058,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
*/
|
||||
_ctrlKeysMap: {
|
||||
65: 'selectAll',
|
||||
67: 'copy',
|
||||
86: 'paste',
|
||||
88: 'cut'
|
||||
},
|
||||
|
||||
|
|
@ -21084,7 +21083,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.canvas && this.canvas.renderAll();
|
||||
|
|
@ -21102,9 +21100,17 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
/**
|
||||
* Copies selected text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
copy: function() {
|
||||
var selectedText = this.getSelectedText();
|
||||
copy: function(e) {
|
||||
var selectedText = this.getSelectedText(),
|
||||
clipboardData = this._getClipboardData(e);
|
||||
|
||||
// Check for backward compatibility with old browsers
|
||||
if (clipboardData) {
|
||||
clipboardData.setData('text', selectedText);
|
||||
}
|
||||
|
||||
this.copiedText = selectedText;
|
||||
this.copiedStyles = this.getSelectionStyles(
|
||||
this.selectionStart,
|
||||
|
|
@ -21113,21 +21119,45 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
/**
|
||||
* Pastes text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
paste: function() {
|
||||
if (this.copiedText) {
|
||||
this.insertChars(this.copiedText);
|
||||
paste: function(e) {
|
||||
var copiedText = null,
|
||||
clipboardData = this._getClipboardData(e);
|
||||
|
||||
// Check for backward compatibility with old browsers
|
||||
if (clipboardData) {
|
||||
copiedText = clipboardData.getData('text');
|
||||
} else {
|
||||
copiedText = this.copiedText;
|
||||
}
|
||||
|
||||
if (copiedText) {
|
||||
this.insertChars(copiedText);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cuts text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
cut: function(e) {
|
||||
if (this.selectionStart === this.selectionEnd) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.copy();
|
||||
this.removeChars(e);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
_getClipboardData: function(e) {
|
||||
return e && (e.clipboardData || fabric.window.clipboardData);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles keypress event
|
||||
* @param {Event} e Event object
|
||||
|
|
@ -21139,7 +21169,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
this.insertChars(String.fromCharCode(e.which));
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
|
|
@ -21629,7 +21658,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
/* _TO_SVG_START_ */
|
||||
fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {
|
||||
|
||||
|
|
|
|||
6
dist/fabric.min.js
vendored
6
dist/fabric.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/fabric.min.js.gz
vendored
BIN
dist/fabric.min.js.gz
vendored
Binary file not shown.
80
dist/fabric.require.js
vendored
80
dist/fabric.require.js
vendored
|
|
@ -14422,6 +14422,10 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
q: 4,
|
||||
t: 2,
|
||||
a: 7
|
||||
},
|
||||
repeatedCommands = {
|
||||
m: 'l',
|
||||
M: 'L'
|
||||
};
|
||||
|
||||
if (fabric.Path) {
|
||||
|
|
@ -14567,8 +14571,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
tempControlX,
|
||||
tempControlY,
|
||||
l = -((this.width / 2) + this.pathOffset.x),
|
||||
t = -((this.height / 2) + this.pathOffset.y),
|
||||
methodName;
|
||||
t = -((this.height / 2) + this.pathOffset.y);
|
||||
|
||||
for (var i = 0, len = this.path.length; i < len; ++i) {
|
||||
|
||||
|
|
@ -14611,21 +14614,13 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
case 'm': // moveTo, relative
|
||||
x += current[1];
|
||||
y += current[2];
|
||||
// draw a line if previous command was moveTo as well (otherwise, it will have no effect)
|
||||
methodName = (previous && (previous[0] === 'm' || previous[0] === 'M'))
|
||||
? 'lineTo'
|
||||
: 'moveTo';
|
||||
ctx[methodName](x + l, y + t);
|
||||
ctx.moveTo(x + l, y + t);
|
||||
break;
|
||||
|
||||
case 'M': // moveTo, absolute
|
||||
x = current[1];
|
||||
y = current[2];
|
||||
// draw a line if previous command was moveTo as well (otherwise, it will have no effect)
|
||||
methodName = (previous && (previous[0] === 'm' || previous[0] === 'M'))
|
||||
? 'lineTo'
|
||||
: 'moveTo';
|
||||
ctx[methodName](x + l, y + t);
|
||||
ctx.moveTo(x + l, y + t);
|
||||
break;
|
||||
|
||||
case 'c': // bezierCurveTo, relative
|
||||
|
|
@ -14990,12 +14985,14 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
}
|
||||
}
|
||||
|
||||
var command = coordsParsed[0].toLowerCase(),
|
||||
commandLength = commandLengths[command];
|
||||
var command = coordsParsed[0],
|
||||
commandLength = commandLengths[command.toLowerCase()],
|
||||
repeatedCommand = repeatedCommands[command] || command;
|
||||
|
||||
if (coordsParsed.length - 1 > commandLength) {
|
||||
for (var k = 1, klen = coordsParsed.length; k < klen; k += commandLength) {
|
||||
result.push([ coordsParsed[0] ].concat(coordsParsed.slice(k, k + commandLength)));
|
||||
result.push([ command ].concat(coordsParsed.slice(k, k + commandLength)));
|
||||
command = repeatedCommand;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -20773,6 +20770,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.__lastClickTime = this.__newClickTime;
|
||||
this.__lastPointer = newPointer;
|
||||
this.__lastIsEditing = this.isEditing;
|
||||
this.__lastSelected = this.selected;
|
||||
},
|
||||
|
||||
isDoubleClick: function(newPointer) {
|
||||
|
|
@ -20884,7 +20882,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.__isMousedown = false;
|
||||
if (this._isObjectMoved(options.e)) return;
|
||||
|
||||
if (this.selected) {
|
||||
if (this.__lastSelected) {
|
||||
this.enterEditing();
|
||||
this.initDelayedCursor(true);
|
||||
}
|
||||
|
|
@ -21032,6 +21030,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keydown', this.onKeyDown.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'keypress', this.onKeyPress.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'copy', this.copy.bind(this));
|
||||
fabric.util.addListener(this.hiddenTextarea, 'paste', this.paste.bind(this));
|
||||
|
||||
|
||||
if (!this._clickHandlerInitialized && this.canvas) {
|
||||
fabric.util.addListener(this.canvas.upperCanvasEl, 'click', this.onClick.bind(this));
|
||||
|
|
@ -21057,8 +21058,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
*/
|
||||
_ctrlKeysMap: {
|
||||
65: 'selectAll',
|
||||
67: 'copy',
|
||||
86: 'paste',
|
||||
88: 'cut'
|
||||
},
|
||||
|
||||
|
|
@ -21084,7 +21083,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.canvas && this.canvas.renderAll();
|
||||
|
|
@ -21102,9 +21100,17 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
/**
|
||||
* Copies selected text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
copy: function() {
|
||||
var selectedText = this.getSelectedText();
|
||||
copy: function(e) {
|
||||
var selectedText = this.getSelectedText(),
|
||||
clipboardData = this._getClipboardData(e);
|
||||
|
||||
// Check for backward compatibility with old browsers
|
||||
if (clipboardData) {
|
||||
clipboardData.setData('text', selectedText);
|
||||
}
|
||||
|
||||
this.copiedText = selectedText;
|
||||
this.copiedStyles = this.getSelectionStyles(
|
||||
this.selectionStart,
|
||||
|
|
@ -21113,21 +21119,45 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
/**
|
||||
* Pastes text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
paste: function() {
|
||||
if (this.copiedText) {
|
||||
this.insertChars(this.copiedText);
|
||||
paste: function(e) {
|
||||
var copiedText = null,
|
||||
clipboardData = this._getClipboardData(e);
|
||||
|
||||
// Check for backward compatibility with old browsers
|
||||
if (clipboardData) {
|
||||
copiedText = clipboardData.getData('text');
|
||||
} else {
|
||||
copiedText = this.copiedText;
|
||||
}
|
||||
|
||||
if (copiedText) {
|
||||
this.insertChars(copiedText);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cuts text
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
cut: function(e) {
|
||||
if (this.selectionStart === this.selectionEnd) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.copy();
|
||||
this.removeChars(e);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} e Event object
|
||||
*/
|
||||
_getClipboardData: function(e) {
|
||||
return e && (e.clipboardData || fabric.window.clipboardData);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles keypress event
|
||||
* @param {Event} e Event object
|
||||
|
|
@ -21139,7 +21169,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
|
||||
this.insertChars(String.fromCharCode(e.which));
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
|
|
@ -21629,7 +21658,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
/* _TO_SVG_START_ */
|
||||
fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue