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AC,KAAK,YAAL,GAAoB,KAAK,WAA1B,KACC,SAAS,KAAK,MAAd,IAAwB,KAAK,YAD9B,CADF;AAKA,iBAAK,QAAL,GAAgB,KAAK,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":""}