1
0
mirror of https://gitee.com/coder-xiaomo/algorithm-visualization synced 2025-09-09 14:11:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

添加水印

This commit is contained in:
2022-05-21 22:43:03 +08:00
parent 52ba2c7088
commit bed6c2b5c8
5 changed files with 51 additions and 1 deletions

View File

@@ -72,6 +72,33 @@ function initArray(elementId, listData) {
console.log(fragment)
workSpace.primaryCanvas.html("")
// 添加水印 居中
var watermarkWidth = settings.outerSize.height * 0.65
shape.addWatermark(elementId, {
imageSrc: "./assets/image/logo-small.svg",
})
.attr('id', 'watermark-c-c')
.attr('x', settings.outerSize.width / 2)
.attr('y', settings.outerSize.height / 2)
.style('width', watermarkWidth + 'px')
.style('height', watermarkWidth + 'px')
.style('transform', `translate(-${watermarkWidth / 2}px, -${watermarkWidth / 2}px)`)
.style('opacity', '0.015')
.style('transition', '0.2s')
// 添加水印 右下角
var watermarkWidth = 60
shape.addWatermark(elementId, {
imageSrc: "./assets/image/logo-small.svg",
})
.attr('id', 'watermark-r-b')
.attr('x', settings.outerSize.width)
.attr('y', settings.outerSize.height)
.style('width', watermarkWidth + 'px')
.style('height', watermarkWidth + 'px')
.style('transform', 'translate(-80px, -80px)')
workSpace.primaryCanvas.node().appendChild(fragment)
document.getElementById(elementId).customAttr = fragment.customAttr
}