Skip to content

Commit

Permalink
Implementation of layer hide
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLortex committed Jan 10, 2018
1 parent 63eef5b commit e451c7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/client/ts/ui/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,29 @@ export class LayerInfo {
public name: string;
public blur: boolean;
public shadow: boolean;
public show: boolean;

constructor() {
this.name = "Layer";
this.blur = false;
this.shadow = false;
this.show = true;
}

getFilter(): string {
if (this.blur || this.shadow) {
if (this.blur || this.shadow || !this.show) {
let s = "";
if (this.blur) {
s += "blur(5px) ";
}

if (this.shadow) {
s += "drop-shadow(5px 5px 5px #000000) ";
}

if (!this.show) {
s += "opacity(0) ";
}
return s;
} else {
return "none";
Expand All @@ -198,13 +205,15 @@ export class LayerInfo {
this.name = layerInfo.name;
this.blur = layerInfo.blur;
this.shadow = layerInfo.shadow;
this.show = layerInfo.show;
}

data(): Object {
return {
name: this.name,
blur: this.blur,
shadow: this.shadow,
show: this.show,
};
}
}
12 changes: 12 additions & 0 deletions src/client/ts/ui/layermenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ export function setup_layer_menu(controller: UIController, base_element: HTMLEle
}
}, "Shadow");

addButton(layer.layerInfo.show ? "visibility" : "visibility_off", function (button) {
if (button.get(0).textContent == "visibility") {
let info = layer.layerInfo.clone();
info.show = false;
controller.project.updateLayerInfo(layer, info);
} else {
let info = layer.layerInfo.clone();
info.show = true;
controller.project.updateLayerInfo(layer, info);
}
}, "Show");

if(i > 0) {
addButton("call_merge", async function (button) {
let content = layer.getHTMLElement().toDataURL();
Expand Down

0 comments on commit e451c7b

Please sign in to comment.