leafer-ui
leafer-ui copied to clipboard
有的 Path data ,添加或设置 cornerRadius 参数,页面直接 卡死了,
'M14 7v1H8v6H7V8H1V7h6V1h1v6h6z', //如果用这个 path data 没影响 'M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z', //这个就死了
我在无意间,设置了path cornerRadius 参数,页面死了,测试代码如下:
<html lang="zh">
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="leafer" style="height: 600px;"></div>
<button id="change" >change </button>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web.min.js"></script>
<script>
const { Leafer, Path } = LeaferUI
const leafer = new Leafer({ view: "leafer" })
const path = new Path({
scale: 2,
//path: 'M14 7v1H8v6H7V8H1V7h6V1h1v6h6z', //如果用这个 path data 没影响
path: 'M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z', //这个就死了
fill: 'red',
x: 50, y: 50,
around: 'center',
hittable: false,
hitFill: 'none',
hitStroke: 'none',
className: 'addicon',
// cornerRadius: 10 //添加了这个参数 卡死,页面无法操作,刷新都不行了
})
leafer.add(path);
var clickcount=0;
document.getElementById("change").addEventListener("click",function(){
let node = leafer.findOne(".addicon");
node.set({ cornerRadius: 10 }); //这个操作之后 卡死,后台无法点击了,页面无法操作,刷新都不行了
alert(++clickcount);
})
</script>
</body>
</html>
收到,谢谢反馈~,Path暂时还不支持cornerRadius,后续会支持