(globalThis.webpackChunksakurairo_scripts=globalThis.webpackChunksakurairo_scripts||[]).push([[9868],{8927:function(t){var i,e,r,o,s,a,l,n;t.exports=(i=function(){return(i=Object.assign||function(t){for(var i,e=1,r=arguments.length;e'),this.settings.flipHorizontal&&(t+=''),this.settings.rotateLeft&&(t+=''),this.settings.rotateRight&&(t+=''),this.core.$toolbar.append(t)},t.prototype.init=function(){var t=this;this.settings.rotate&&(this.buildTemplates(),this.rotateValuesList={},this.core.LGel.on(e+".rotate",(function(i){var e=i.detail.index;t.core.getSlideItem(e).find(".lg-img-rotate").get()||(t.core.getSlideItem(e).find(".lg-object").first().wrap("lg-img-rotate"),t.core.getSlideItem(t.core.index).find(".lg-img-rotate").css("transition-duration",t.settings.rotateSpeed+"ms"))})),this.core.outer.find("#lg-rotate-left").first().on("click.lg",this.rotateLeft.bind(this)),this.core.outer.find("#lg-rotate-right").first().on("click.lg",this.rotateRight.bind(this)),this.core.outer.find("#lg-flip-hor").first().on("click.lg",this.flipHorizontal.bind(this)),this.core.outer.find("#lg-flip-ver").first().on("click.lg",this.flipVertical.bind(this)),this.core.LGel.on(r+".rotate",(function(i){t.rotateValuesList[i.detail.index]||(t.rotateValuesList[i.detail.index]={rotate:0,flipHorizontal:1,flipVertical:1})})))},t.prototype.applyStyles=function(){this.core.getSlideItem(this.core.index).find(".lg-img-rotate").first().css("transform","rotate("+this.rotateValuesList[this.core.index].rotate+"deg) scale3d("+this.rotateValuesList[this.core.index].flipHorizontal+", "+this.rotateValuesList[this.core.index].flipVertical+", 1)")},t.prototype.rotateLeft=function(){this.rotateValuesList[this.core.index].rotate-=90,this.applyStyles(),this.triggerEvents(o,{rotate:this.rotateValuesList[this.core.index].rotate})},t.prototype.rotateRight=function(){this.rotateValuesList[this.core.index].rotate+=90,this.applyStyles(),this.triggerEvents(s,{rotate:this.rotateValuesList[this.core.index].rotate})},t.prototype.getCurrentRotation=function(t){if(!t)return 0;var i=this.$LG(t).style(),e=i.getPropertyValue("-webkit-transform")||i.getPropertyValue("-moz-transform")||i.getPropertyValue("-ms-transform")||i.getPropertyValue("-o-transform")||i.getPropertyValue("transform")||"none";if("none"!==e){var r=e.split("(")[1].split(")")[0].split(",");if(r){var o=Math.round(Math.atan2(r[1],r[0])*(180/Math.PI));return o<0?o+360:o}}return 0},t.prototype.flipHorizontal=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-img-rotate").first().get(),i=this.getCurrentRotation(t),e="flipHorizontal";90!==i&&270!==i||(e="flipVertical"),this.rotateValuesList[this.core.index][e]*=-1,this.applyStyles(),this.triggerEvents(a,{flipHorizontal:this.rotateValuesList[this.core.index][e]})},t.prototype.flipVertical=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-img-rotate").first().get(),i=this.getCurrentRotation(t),e="flipVertical";90!==i&&270!==i||(e="flipHorizontal"),this.rotateValuesList[this.core.index][e]*=-1,this.applyStyles(),this.triggerEvents(l,{flipVertical:this.rotateValuesList[this.core.index][e]})},t.prototype.triggerEvents=function(t,i){var e=this;setTimeout((function(){e.core.LGel.trigger(t,i)}),this.settings.rotateSpeed+10)},t.prototype.isImageOrientationChanged=function(){var t=this.rotateValuesList[this.core.index],i=Math.abs(t.rotate)%360!=0,e=t.flipHorizontal<0,r=t.flipVertical<0;return i||e||r},t.prototype.closeGallery=function(){this.isImageOrientationChanged()&&this.core.getSlideItem(this.core.index).css("opacity",0),this.rotateValuesList={}},t.prototype.destroy=function(){this.core.LGel.off(".lg.rotate"),this.core.LGel.off(".rotate")},t}())}}]); //# sourceMappingURL=lg-7.js.map