File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 1717 "html-webpack-plugin" : " ^5.6.0" ,
1818 "inline-source-map" : " 0.6.3" ,
1919 "jest" : " ^29.7.0" ,
20- "prettier" : " 3.3.3" ,
20+ "prettier" : " ^ 3.3.3" ,
2121 "style-loader" : " 4.0.0" ,
2222 "ts-jest" : " ^29.2.5" ,
2323 "ts-loader" : " 9.5.1" ,
Original file line number Diff line number Diff line change @@ -92,6 +92,15 @@ export class Packet extends Graphics {
9292 ) ;
9393
9494 rightbar . renderInfo ( info ) ;
95+
96+ // Add a delete packet button with the delete button style
97+ rightbar . addButton (
98+ "Delete Packet" ,
99+ ( ) => {
100+ this . delete ( ) ;
101+ } ,
102+ "right-bar-delete-button" ,
103+ ) ;
95104 }
96105
97106 highlight ( ) {
@@ -157,13 +166,28 @@ export class Packet extends Graphics {
157166 const dx = end . x - start . x ;
158167 const dy = end . y - start . y ;
159168
160- // Mover el paquete
169+ // Move packet
161170 this . x = start . x + progress * dx ;
162171 this . y = start . y + progress * dy ;
163172 }
164173
165174 delete ( ) {
166- // TODO: Implement delete functionality
175+ // Remove packet from Ticker to stop animation
176+ Ticker . shared . remove ( this . animationTick , this ) ;
177+
178+ // Remove all event listeners
179+ this . removeAllListeners ( ) ;
180+
181+ // Remove packet from parent edge
182+ this . removeFromParent ( ) ;
183+
184+ // Deselect the packet if it's selected
185+ if ( isSelected ( this ) ) {
186+ deselectElement ( ) ;
187+ }
188+
189+ // Destroy the packet
190+ this . destroy ( ) ;
167191 }
168192}
169193
You can’t perform that action at this time.
0 commit comments