@@ -36,6 +36,11 @@ export class LayersPanel extends LitElement {
36
36
margin: 0;
37
37
}
38
38
39
+ .actions {
40
+ padding: 4px;
41
+ padding-top: 0;
42
+ }
43
+
39
44
.container {
40
45
height: 300px;
41
46
overflow: hidden;
@@ -60,6 +65,25 @@ export class LayersPanel extends LitElement {
60
65
) ;
61
66
}
62
67
68
+ private handleDelete ( ) {
69
+ const { layersSelected } = this . api . getAppState ( ) ;
70
+ this . api . deleteNodesById ( layersSelected ) ;
71
+
72
+ // Try to select the next layer
73
+ const nextLayer = this . nodes . find (
74
+ ( node ) => ! layersSelected . includes ( node . id ) ,
75
+ ) ;
76
+ if ( nextLayer ) {
77
+ this . api . selectNodes ( [ nextLayer . id ] ) ;
78
+ }
79
+
80
+ // TODO: scroll to the selected layer
81
+ }
82
+
83
+ private handleAdd ( ) {
84
+ // this.api.addNodes(this.nodes);
85
+ }
86
+
63
87
private handleSelect ( e : MouseEvent , id : SerializedNode [ 'id' ] ) {
64
88
const { layersSelected } = this . api . getAppState ( ) ;
65
89
@@ -81,6 +105,23 @@ export class LayersPanel extends LitElement {
81
105
< sp-icon-close slot ="icon "> </ sp-icon-close >
82
106
</ sp-action-button >
83
107
</ h4 >
108
+ < sp-action-group class ="actions ">
109
+ < sp-action-button quiet size ="s " @click =${ this . handleAdd } >
110
+ < sp-tooltip self-managed placement ="bottom ">
111
+ Add new layer
112
+ </ sp-tooltip >
113
+ < sp-icon-add slot ="icon "> </ sp-icon-add >
114
+ </ sp-action-button >
115
+ < sp-action-button
116
+ quiet
117
+ size ="s "
118
+ @click =${ this . handleDelete }
119
+ .disabled =${ layersSelected . length === 0 }
120
+ >
121
+ < sp-tooltip self-managed placement ="bottom "> Delete </ sp-tooltip >
122
+ < sp-icon-delete slot ="icon "> </ sp-icon-delete >
123
+ </ sp-action-button >
124
+ </ sp-action-group >
84
125
< div class ="container ">
85
126
${ map ( this . nodes , ( node ) => {
86
127
// TODO: hierarchy
0 commit comments