Prevent items from sticking on touchend.
This commit is contained in:
parent
084642eb0a
commit
2bbe21fb89
2 changed files with 6 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// 2018-05-20 15:22:33.784038886 -0700 PDT m=+0.015509399
|
||||
// 2018-06-06 18:30:00.64689124 +0000 UTC m=+0.004975400
|
||||
|
||||
package static
|
||||
|
||||
|
@ -22,7 +22,8 @@ this.reset();this.touch.start.x=event.touches[0].clientX;this.touch.start.y=even
|
|||
onTouchMove(event){if(event.touches===undefined||event.touches.length!==1||this.element===null){return;}
|
||||
this.touch.move.x=event.touches[0].clientX;this.touch.move.y=event.touches[0].clientY;let distance=this.calculateDistance();let absDistance=Math.abs(distance);if(absDistance>0){let opacity=1-(absDistance>75?0.9:absDistance/75*0.9);let tx=distance>75?75:(distance<-75?-75:distance);this.touch.element.style.opacity=opacity;this.touch.element.style.transform="translateX("+tx+"px)";}}
|
||||
onTouchEnd(event){if(event.touches===undefined){return;}
|
||||
if(this.touch.element!==null){let distance=Math.abs(this.calculateDistance());if(distance>75){EntryHandler.toggleEntryStatus(this.touch.element);this.touch.element.style.opacity=1;this.touch.element.style.transform="none";}}
|
||||
if(this.touch.element!==null){let distance=Math.abs(this.calculateDistance());if(distance>75){EntryHandler.toggleEntryStatus(this.touch.element);}
|
||||
this.touch.element.style.opacity=1;this.touch.element.style.transform="none";}
|
||||
this.reset();}
|
||||
listen(){let elements=document.querySelectorAll(".touch-item");elements.forEach((element)=>{element.addEventListener("touchstart",(e)=>this.onTouchStart(e),false);element.addEventListener("touchmove",(e)=>this.onTouchMove(e),false);element.addEventListener("touchend",(e)=>this.onTouchEnd(e),false);element.addEventListener("touchcancel",()=>this.reset(),false);});}}
|
||||
class KeyboardHandler{constructor(){this.queue=[];this.shortcuts={};}
|
||||
|
@ -91,5 +92,5 @@ document.addEventListener("DOMContentLoaded",function(){FormHandler.handleSubmit
|
|||
}
|
||||
|
||||
var JavascriptChecksums = map[string]string{
|
||||
"app": "cfeb45231fd784b9eaceefb12ecf7f2543e4c871fb3af3cebf25757446e3eae7",
|
||||
"app": "69dd98768624d2d683b6ba27f558b06e16451e63b460e091dafd7601ca29dad4",
|
||||
}
|
||||
|
|
|
@ -122,9 +122,9 @@ class TouchHandler {
|
|||
|
||||
if (distance > 75) {
|
||||
EntryHandler.toggleEntryStatus(this.touch.element);
|
||||
this.touch.element.style.opacity = 1;
|
||||
this.touch.element.style.transform = "none";
|
||||
}
|
||||
this.touch.element.style.opacity = 1;
|
||||
this.touch.element.style.transform = "none";
|
||||
}
|
||||
|
||||
this.reset();
|
||||
|
|
Loading…
Reference in a new issue