Skip to content

Commit

Permalink
截屏 设置颜色暂时使用原先的组件
Browse files Browse the repository at this point in the history
  • Loading branch information
xushengfeng committed Aug 4, 2024
1 parent 1478957 commit 52fc15c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/renderer/clip/clip_window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2316,14 +2316,23 @@ function colorInput(type: "fill" | "stroke") {
setC();
main.el.dispatchEvent(new Event("input"));
});
const alpha = ele("input") // todo range-b
.attr({ type: "number", max: "1", min: "0", step: "0.01" })
const alpha = ele("range-b") // todo range-b
.on("input", () => {
setC();
main.el.dispatchEvent(new Event("input"));
})
.bindGet((el: HTMLInputElement) => {
return el.value;
})
.bindSet((v, el: HTMLInputElement) => {
el.value = v;
});
alpha.el.setAttribute("max", "1");
alpha.el.setAttribute("min", "0");
alpha.el.setAttribute("step", "0.01");

function getInputV() {
return Color(i.gv()).alpha(Number(alpha.el.value));
return Color(i.gv()).alpha(Number(alpha.gv()));
}
function setC() {
const color = getInputV();
Expand Down Expand Up @@ -2367,7 +2376,7 @@ function colorInput(type: "fill" | "stroke") {
.bindSet((v: string) => {
const color = Color(v);
i.sv(color.hex());
alpha.el.value = String(color.alpha());
alpha.sv(String(color.alpha()));
setC();
})
.bindGet(() => {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/css/clip.css
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ range-b {
line-height: calc(var(--bar-size) / 5);
text-align: start;
border-radius: inherit;
display: block;
}
#draw_color_p > div > :last-child {
height: calc(var(--bar-size) / 2);
Expand Down

0 comments on commit 52fc15c

Please sign in to comment.