{"version":3,"sources":["webpack:///./widgets/horizontalScrollBlock.js"],"names":["HorizontalScrollBlock","$el","_classCallCheck","this","key","value","setHorizontalScrollBlock","$wg","$","scroller","scrollerItems","find","WG","PerfectScrollbar","minScrollbarLength","maxScrollbarLength","addEventListener","e","deltaY","offset","top","window","scrollTop","scrollDirection","scrollLeft","Math","round","maxScrollLeft","scrollWidth","clientWidth","preventDefault"],"mappings":"43BAGA,IAUaA,EAAqB,WAIhC,O,EAHD,SAAAA,EAAYC,I,4FAAKC,CAAA,KAAAF,GAEhBG,KAAKF,IAAMA,I,EACX,EAAAG,IAAA,OAAAC,MAED,WACCF,KAAKG,6BACL,CAAAF,IAAA,2BAAAC,MAED,WACC,IAAME,EAAMC,EAAEL,KAAKF,KAGfQ,EAAWF,EAAI,GACfG,EAAgBH,EAAII,KAAKC,gCAAc,GAE3C,IAAIC,IAAiBH,EAAe,CACnCI,mBAAoB,IACpBC,mBAAoB,MAGrBN,EAASO,iBAAiB,cAAc,SAACC,GACxC,GAAKA,EAAEC,QAEHX,EAAIY,SAASC,IAAMZ,EAAEa,QAAQC,aAAgB,EAAjD,CAEA,IAAIC,EAAmBN,EAAEC,OAAS,EAAK,GAAK,EAE5CR,EAAcc,YAhBG,GAgByBD,EAE1C,IAAIC,EAAaC,KAAKC,MAAMhB,EAAcc,YACtCG,EAAgBF,KAAKC,MAAMhB,EAAckB,YAAclB,EAAcmB,aAOzE,QAJuB,IAArBN,GAA0BC,EAAa,GACnB,IAApBD,GAAyBC,EAAaG,IACtCV,EAAEa,kBAEG,MACL,Q,0FAxC6B,I","file":"37.js","sourcesContent":["/* eslint-disable max-len */\n/* eslint-disable no-unused-vars */\n// CONSTANTS are all caps.\nconst NS = 'HorizontalScrollBlock';\nconst CLS = 'horizontalScrollBlock';\nconst WG = '.' + CLS + '-';\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/horizontalScrollBlock.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\nimport PerfectScrollbar from 'perfect-scrollbar';\nimport utils from '../utils';\n\nexport class HorizontalScrollBlock {\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadHorizontalScrollBlock function\n\t\tthis.$el = $el;\n\t}\n\n\tinit() {\n\t\tthis.setHorizontalScrollBlock();\n\t}\n\n\tsetHorizontalScrollBlock() {\n\t\tconst $wg = $(this.$el);\n\n\t\tlet scrollSpeed = 20;\n\t\tlet scroller = $wg[0];\n\t\tlet scrollerItems = $wg.find(WG + 'items')[0];\n\n\t\tnew PerfectScrollbar(scrollerItems, {\n\t\t\tminScrollbarLength: 100,\n\t\t\tmaxScrollbarLength: 200,\n\t\t});\n\n\t\tscroller.addEventListener('mousewheel', (e) => {\n\t\t\tif (!e.deltaY) return;\n\n\t\t\tif ($wg.offset().top - $(window).scrollTop() !== 0) return;\n\n\t\t\tlet scrollDirection = (e.deltaY > 0) ? 1 : -1;\n\n\t\t\tscrollerItems.scrollLeft += scrollSpeed * scrollDirection;\n\n\t\t\tlet scrollLeft = Math.round(scrollerItems.scrollLeft);\n\t\t\tlet maxScrollLeft = Math.round(scrollerItems.scrollWidth - scrollerItems.clientWidth);\n\n\t\t\tif (\n\t\t\t\t(scrollDirection === -1 && scrollLeft > 0) ||\n\t\t\t\t(scrollDirection === 1 && scrollLeft < maxScrollLeft)\n\t\t\t) e.preventDefault();\n\n\t\t\treturn true;\n\t\t}, false);\n\t}\n\n\t// Add more functions like on above here\n}\n"],"sourceRoot":""}