UNPKG

toloframework

Version:

Javascript/HTML/CSS compiler for Firefox OS or nodewebkit apps using modules in the nodejs style.

2 lines 1.8 kB
require("tfw.touchable",function(t,e,a){var i=function(){function e(){return i(a,arguments)}var a={en:{},fr:{}},i=t("$").intl;return e.all=a,e}(),o=t("dom"),n=t("dom.fx"),s=t("tfw.listeners"),r=function(t,e){var a=this;void 0===e&&(e={}),void 0===e.enabled&&(e.enabled=!0),t=o(t),this.enabled=e.enabled,this.color=e.color||"#fd8",this.classToAdd=e.classToAdd,this.opacity=e.opacity||.4,this.element=o(t),this.tap=new s,this.press=new s,o.addClass(t,"tfw-touchable");var i,r,c=o.div("tfw-touchable-shadow"),l=n().css(c,{transition:"none",transform:"scale(0)"}).exec(function(e){var n=a.classToAdd;"string"==typeof n&&o.addClass(t,n),-1==["relative","absolute","fixed"].indexOf(getComputedStyle(t).position)&&(t.style.position="relative"),t.style.overflow="hidden";var s=t.getBoundingClientRect(),l=s.width,d=s.height;l=Math.max(i,l-i),d=Math.max(r,d-r);var f=Math.ceil(Math.sqrt(l*l+d*d));o.css(c,{left:i+"px",top:r+"px",margin:"-"+f+"px",width:2*f+"px",height:2*f+"px",opacity:0,background:a.color,transform:"scale(0)",transition:"all .15s ease","transition-timing-function":"cubic-bezier(0,1,0.780,1)","-moz-transition-timing-function":"cubic-bezier(0,1,0.780,1)","-webkit-transition-timing-function":"cubic-bezier(0,1,0.780,1)"}),o.add(t,c)}).wait(10).css(c,{opacity:a.opacity,transform:"scale(.25)"}).wait(150).css(c,{transform:"scale(.2)"}).wait(150).css(c,{transition:"all .6s ease",transform:"scale(1)",opacity:0}).wait(600).detach(c).exec(function(){var e=a.classToAdd;"string"==typeof e&&o.removeClass(t,e)}),d=0;o.on(t,{down:function(t){a.enabled&&(t.stopPropagation(),t.preventDefault(),i=Math.floor(t.x),r=Math.floor(t.y),l.start(),d=Date.now())},tap:function(t){a.enabled&&(console.log("TAP",t),a.tap.fire(t))}})};e.exports=r,e.exports._=i}); //# sourceMappingURL=tfw.touchable.js.map