diff --git a/app/elements/kano-bitmap-list/kano-bitmap-list.html b/app/elements/kano-bitmap-list/kano-bitmap-list.html
index 4f974f385..4e3c0d92d 100644
--- a/app/elements/kano-bitmap-list/kano-bitmap-list.html
+++ b/app/elements/kano-bitmap-list/kano-bitmap-list.html
@@ -155,7 +155,7 @@
heading="Do you mean to start again?"
text="You are about to delete all the frames!">
-
+
@@ -311,11 +311,27 @@
}
},
deleteAllFrames () {
- if (this.bitmaps.length > 1) {
+ //alert user
+ if (Array.isArray(this.bitmaps)
+ && this.bitmaps.length > 1
+ && this._bitmapsNotEmpty()) {
this.$['delete-all-alert'].open();
+ //there's only one frame or all frames are empty - delete without alert
+ } else {
+ this._confirmDeleteAll();
}
},
- confirmDeleteAll () {
+ _bitmapsNotEmpty () {
+ let allColors = this.bitmaps.reduce((acc, bitmap, index, bitmaps) => {
+ if (bitmaps.indexOf(bitmap) === index) {
+ return acc.concat(bitmap);
+ }
+ }, []);
+ return allColors.some(value => {
+ return value !== '#000000'
+ });
+ },
+ _confirmDeleteAll () {
this.set('bitmaps', []);
this.fire('tracking-event', {
name: 'all_bitmap_frames_removed'