diff --git a/shiny/Contacts-v2/components/contacts-list.html b/shiny/Contacts-v2/components/contacts-list.html index 014eb21..f891251 100644 --- a/shiny/Contacts-v2/components/contacts-list.html +++ b/shiny/Contacts-v2/components/contacts-list.html @@ -178,11 +178,15 @@
+
+ + - + + + @@ -261,9 +265,24 @@ this.$.slideAnimation.apply(); }, scrubAnimationEndAction: function(e, detail, sender) { - sender.target.remove(); - var index = this.$.mock.withHeaders.indexOf(sender.target.templateInstance.model.contact.__proto__); - console.log('index', index, sender.target.templateInstance.model.contact); + this.deletedContact = sender.target.templateInstance.model.contact.__proto__; + var listRect = this.$.list.getBoundingClientRect(); + var itemRect = sender.target.getBoundingClientRect(); + var height = listRect.bottom - itemRect.top; + var item = sender.target; + var targets = []; + do { + item = item.nextElementSibling; + if (item.classList.contains('contactItem')) { + targets.push(item); + height -= itemRect.height; + } + } while (height > 0); + this.$.deleteAnimation.target = targets; + this.$.deleteAnimation.play(); + }, + deleteAnimationEndAction: function(e, detail, sender) { + var index = this.$.mock.withHeaders.indexOf(this.deletedContact); this.$.mock.withHeaders.splice(index, 1); this.$.list.forceUpdate(); },