【发布时间】:2016-12-22 09:11:48
【问题描述】:
我试图将缩放图案添加为画布背景,但没有成功。我将此代码添加到 fabric.js 因为我需要添加缩放图案作为背景。
__setBgOverlayColor: function(property, color, callback) {
if(color && color.source && color.width && color.height) {
var _this = this;
fabric.util.loadImage(color.source, function(img) {
var pattern = new fabric.Rect({
width: color.width,
height: color.height,
top:0,
left:0
});
pattern.setPatternFill({
source: img,
repeat: 'repeat'
});
_this[property] = pattern;
callback && callback();
});
} else if (color && color.source) {
var _this = this;
fabric.util.loadImage(color.source, function(img) {
...
...
但是这个空的黑屏。不是模式
【问题讨论】:
标签: html5-canvas fabricjs