11import { Component , Part } from '@pictogrammers/element' ;
22import PgInputPixelEditor from '../../inputPixelEditor' ;
3+ import PgTable , { createTableItem } from '../../../table/table' ;
4+ import PgTableCellButtonIcon from '../../../tableCellButtonIcon/tableCellButtonIcon' ;
35import { maskToBitmap } from '../../utils/maskToBitmap' ;
46import { patterns } from './constants' ;
57
68import template from './basic.html' ;
79import style from './basic.css' ;
8- import PgTable from 'pg/table/table' ;
10+
11+ const IconTrash = 'M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z' ;
912
1013@Component ( {
1114 selector : 'x-pg-input-pixel-editor-basic' ,
@@ -45,6 +48,7 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
4548 @Part ( ) $savePng : HTMLInputElement ;
4649
4750 @Part ( ) $addLayer : HTMLButtonElement ;
51+ @Part ( ) $addColor : HTMLButtonElement ;
4852
4953 @Part ( ) $colors : PgTable ;
5054 @Part ( ) $layers : PgTable ;
@@ -154,10 +158,12 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
154158 } , {
155159 label : 'Selected' ,
156160 key : 'selected' ,
161+ hideLabel : true ,
157162 } ] ;
158163 this . $addLayer . addEventListener ( 'click' , ( ) => {
159164 // number[][][]
160165 // this.$input.addLayer();
166+
161167 } ) ;
162168 // Colors
163169 this . $colors . columns = [ {
@@ -172,7 +178,23 @@ export default class XPgInputPixelEditorBasic extends HTMLElement {
172178 } , {
173179 label : 'Alpha' ,
174180 key : 'a' ,
181+ } , {
182+ label : 'Delete' ,
183+ key : 'delete' ,
184+ hideLabel : true ,
175185 } ] ;
186+ this . $addColor . addEventListener ( 'click' , ( ) => {
187+ this . $colors . data . push ( createTableItem ( {
188+ r : 5 ,
189+ g : 5 ,
190+ b : 5 ,
191+ a : 1 ,
192+ delete : {
193+ type : PgTableCellButtonIcon ,
194+ icon : IconTrash
195+ }
196+ } ) ) ;
197+ } ) ;
176198 }
177199
178200 handleFile ( e ) {
0 commit comments