【发布时间】:2021-12-24 21:41:42
【问题描述】:
我正在尝试将木镶板的图像添加到设计为看起来像一个房间的 fabric.js 画布上。我希望木镶板的图像被拉伸并且纵横比被忽略,所以它覆盖了整面墙。但是,图像当前正在被裁剪。在此处查看图片:Image of cropped panelling
有人可以帮帮我吗?
const getPanelling = (hex) => {
const imageSrc = self.$nuxt.$store.getters['component_data/data']('wallImgURL')
var filter = new fabric.Image.filters.BlendColor({
mode: 'overlay',
alpha: 0.7,
color: hex
})
fabric.Image.fromURL(imageSrc, (image) => {
image.filters.push(filter)
image.applyFilters()
image.type = 'wall'
canvas.add(image)
canvas.sendToBack(image)
}, {
top: ceilingHeight(),
height: floorLevel() - ceilingHeight(),
width: canvas.width,
backgroundImageStretch: false,
crossOrigin: 'anonymous',
hoverCursor: 'default',
selectable: false, // make this object not selectable
originY: 'top',
})
}
【问题讨论】:
标签: fabricjs