mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-10 14:54:42 +00:00
Fix fabric.Text#set.
This commit is contained in:
parent
0171b665be
commit
7cf01772a4
5 changed files with 15 additions and 21 deletions
14
dist/all.js
vendored
14
dist/all.js
vendored
|
|
@ -13626,19 +13626,13 @@ fabric.Image.filters.Tint.fromObject = function(object) {
|
|||
* @return {fabric.Text} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
set: function(name, value) {
|
||||
if (typeof name == 'object') {
|
||||
for (var prop in name) {
|
||||
this.set(prop, name[prop]);
|
||||
}
|
||||
_set: function(name, value) {
|
||||
if (name === 'fontFamily' && this.path) {
|
||||
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
|
||||
}
|
||||
else {
|
||||
this[name] = value;
|
||||
if (name === 'fontFamily' && this.path) {
|
||||
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
|
||||
}
|
||||
this.callSuper('_set', name, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
2
dist/all.min.js
vendored
2
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -736,19 +736,13 @@
|
|||
* @return {fabric.Text} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
set: function(name, value) {
|
||||
if (typeof name == 'object') {
|
||||
for (var prop in name) {
|
||||
this.set(prop, name[prop]);
|
||||
}
|
||||
_set: function(name, value) {
|
||||
if (name === 'fontFamily' && this.path) {
|
||||
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
|
||||
}
|
||||
else {
|
||||
this[name] = value;
|
||||
if (name === 'fontFamily' && this.path) {
|
||||
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
|
||||
}
|
||||
this.callSuper('_set', name, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@
|
|||
var text = createTextObject();
|
||||
ok(typeof text.set == 'function');
|
||||
equal(text.set('text', 'bar'), text, 'should be chainable');
|
||||
|
||||
text.set({ left: 1234, top: 2345, angle: 55 });
|
||||
|
||||
equal(text.get('left'), 1234);
|
||||
equal(text.get('top'), 2345);
|
||||
equal(text.get('angle'), 55);
|
||||
});
|
||||
|
||||
test('set with "hash"', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue