便签:未选中金底黑字带1px黑边,选中黑底金字带金边

This commit is contained in:
2026-09-19 16:16:20 +08:00
parent 7f6855d9ae
commit 7ffcbbcfee
+16 -8
View File
@@ -90,22 +90,30 @@ function makeStickyNote(text, fontSize, selected = false) {
ctx.closePath();
if (selected) {
// 先描粗边,再填充盖住内侧一半 → 外露 2px 干净黑边
ctx.strokeStyle = '#14100d';
ctx.lineWidth = B * 2; // 4px,外露 2px
// 选中:黑底金字,外圈 2px 金边(先描边再填充,外露一半)
ctx.strokeStyle = '#e0c46a';
ctx.lineWidth = B * 2;
ctx.lineJoin = 'round';
ctx.stroke();
ctx.fillStyle = '#14100d';
ctx.fill();
ctx.fillStyle = '#e0c46a';
} else {
// 非选中:柔和的投影
// 非选中:金底黑字 + 1px 黑边(描 2px,填充盖掉内侧 1px)+ 柔和投影
ctx.strokeStyle = '#14100d';
ctx.lineWidth = 2;
ctx.lineJoin = 'round';
ctx.stroke();
ctx.shadowColor = 'rgba(0, 0, 0, 0.20)';
ctx.shadowBlur = 5;
ctx.shadowOffsetY = 2;
ctx.fillStyle = '#e0c46a';
ctx.fill();
ctx.shadowColor = 'transparent';
ctx.fillStyle = '#14100d';
}
ctx.fillStyle = '#e0c46a';
ctx.fill();
// 黑色加粗文字
ctx.fillStyle = '#14100d';
// 文字
ctx.font = font;
ctx.textBaseline = 'middle';
ctx.textAlign = 'center';