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xB,EAAkC,KAAK,SAAvC,EAAkD,KAAlD;AACA,MAAA,MAAM,CAAC,gBAAP,CAAwB,QAAxB,EAAkC,KAAK,SAAvC,EAAkD,KAAlD;AACD,KAbM;;AAcP;AACA,IAAA,SAfO,uBAeE;AACP,YAAM,IAAI,KAAJ,CAAU,mBAAV,CAAN;AACD,KAjBM;AAkBP,IAAA,SAlBO,uBAkBE;AACP,WAAK,cAAL;AAEA,WAAK,eAAL,GACE,CAAC,KAAK,YAAL,GAAoB,KAAK,WAA1B,KACC,QAAQ,CAAC,KAAK,MAAN,CAAR,GAAwB,KAAK,YAD9B,CADF;AAKA,WAAK,QAAL,GAAgB,IAAI,CAAC,KAAL,CAAW,KAAK,YAAL,GAAoB,KAAK,eAApC,CAAhB;AACD;AA3BM;AA5Be,CAAX,C","sourcesContent":["import Vue from 'vue'\n\nexport default Vue.extend({\n name: 'translatable',\n\n props: {\n height: Number,\n },\n\n data: () => ({\n elOffsetTop: 0,\n parallax: 0,\n parallaxDist: 0,\n percentScrolled: 0,\n scrollTop: 0,\n windowHeight: 0,\n windowBottom: 0,\n }),\n\n computed: {\n imgHeight (): number {\n return this.objHeight()\n },\n },\n\n beforeDestroy () {\n window.removeEventListener('scroll', this.translate, false)\n window.removeEventListener('resize', this.translate, false)\n },\n\n methods: {\n calcDimensions () {\n const offset = this.$el.getBoundingClientRect()\n\n this.scrollTop = window.pageYOffset\n this.parallaxDist = this.imgHeight - this.height\n this.elOffsetTop = offset.top + this.scrollTop\n this.windowHeight = window.innerHeight\n this.windowBottom = this.scrollTop + this.windowHeight\n },\n listeners () {\n window.addEventListener('scroll', this.translate, false)\n window.addEventListener('resize', this.translate, false)\n },\n /** @abstract **/\n objHeight (): number {\n throw new Error('Not implemented !')\n },\n translate () {\n this.calcDimensions()\n\n this.percentScrolled = (\n (this.windowBottom - this.elOffsetTop) /\n (parseInt(this.height) + this.windowHeight)\n )\n\n this.parallax = Math.round(this.parallaxDist * this.percentScrolled)\n },\n },\n})\n"],"sourceRoot":"","file":"index.js"} |