mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-28 17:24:42 +00:00
Prevent errors in FF when rendering non-ready patterns
This commit is contained in:
parent
9ff21bf531
commit
f53559773f
5 changed files with 21 additions and 6 deletions
5
dist/all.js
vendored
5
dist/all.js
vendored
|
|
@ -6437,6 +6437,11 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
|
|||
*/
|
||||
toLive: function(ctx) {
|
||||
var source = typeof this.source === 'function' ? this.source() : this.source;
|
||||
// if an image
|
||||
if (typeof source.src !== 'undefined') {
|
||||
if (!source.complete) return '';
|
||||
if (source.naturalWidth === 0 || source.naturalHeight === 0) return '';
|
||||
}
|
||||
return ctx.createPattern(source, this.repeat);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
12
dist/all.min.js
vendored
12
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.
5
dist/all.require.js
vendored
5
dist/all.require.js
vendored
|
|
@ -6437,6 +6437,11 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
|
|||
*/
|
||||
toLive: function(ctx) {
|
||||
var source = typeof this.source === 'function' ? this.source() : this.source;
|
||||
// if an image
|
||||
if (typeof source.src !== 'undefined') {
|
||||
if (!source.complete) return '';
|
||||
if (source.naturalWidth === 0 || source.naturalHeight === 0) return '';
|
||||
}
|
||||
return ctx.createPattern(source, this.repeat);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
|
|||
*/
|
||||
toLive: function(ctx) {
|
||||
var source = typeof this.source === 'function' ? this.source() : this.source;
|
||||
// if an image
|
||||
if (typeof source.src !== 'undefined') {
|
||||
if (!source.complete) return '';
|
||||
if (source.naturalWidth === 0 || source.naturalHeight === 0) return '';
|
||||
}
|
||||
return ctx.createPattern(source, this.repeat);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue