D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
grandhou
/
public_html
/
album
/
album-js
/
Filename :
lg-rotate.min.js
back
Copy
/**! * lg-rotate.js | 1.2.0-beta.0 | October 5th 2020 * http://sachinchoolur.github.io/lg-rotate.js * Copyright (c) 2016 Sachin N; * @license GPLv3 */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.LgRotate=t()}}(function(){var t,e,o;return function(){function t(e,o,r){function i(n,a){if(!o[n]){if(!e[n]){var s="function"==typeof require&&require;if(!a&&s)return s(n,!0);if(l)return l(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var c=o[n]={exports:{}};e[n][0].call(c.exports,function(t){return i(e[n][1][t]||t)},c,c.exports,t,e,o,r)}return o[n].exports}for(var l="function"==typeof require&&require,n=0;n<r.length;n++)i(r[n]);return i}return t}()({1:[function(e,o,r){!function(e,o){if("function"==typeof t&&t.amd)t([],o);else if(void 0!==r)o();else{var i={exports:{}};o(),e.lgRotate=i.exports}}(this,function(){"use strict";var t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},e={rotate:!0,rotateLeft:!0,rotateRight:!0,flipHorizontal:!0,flipVertical:!0},o=function o(r){return this.core=window.lgData[r.getAttribute("lg-uid")],this.core.s=t({},e,this.core.s),this.core.s.rotate&&this.core.doCss()&&this.init(),this};o.prototype.buildTemplates=function(){var t="";this.core.s.flipVertical&&(t+='<button aria-label="flip vertical" class="lg-flip-ver lg-icon"></button>'),this.core.s.flipHorizontal&&(t+='<button aria-label="Flip horizontal" class="lg-flip-hor lg-icon"></button>'),this.core.s.rotateLeft&&(t+='<button aria-label="Rotate left" class="lg-rotate-left lg-icon"></button>'),this.core.s.rotateRight&&(t+='<button aria-label="Rotate right" class="lg-rotate-right lg-icon"></button>'),this.core.outer.querySelector(".lg-toolbar").insertAdjacentHTML("beforeend",t)},o.prototype.init=function(){var t=this;this.buildTemplates(),this.rotateValuesList={},utils.on(t.core.el,"onAferAppendSlide.lgtmrotate",function(e){var o=t.core.___slide[e.detail.index].querySelector(".lg-img-wrap");utils.wrap(o,"lg-img-rotate")}),utils.on(t.core.outer.querySelector(".lg-rotate-left"),"click.lg",this.rotateLeft.bind(this)),utils.on(t.core.outer.querySelector(".lg-rotate-right"),"click.lg",this.rotateRight.bind(this)),utils.on(t.core.outer.querySelector(".lg-flip-hor"),"click.lg",this.flipHorizontal.bind(this)),utils.on(t.core.outer.querySelector(".lg-flip-ver"),"click.lg",this.flipVertical.bind(this)),utils.on(t.core.el,"onBeforeSlide.lgtmrotate",function(e){t.rotateValuesList[e.detail.index]||(t.rotateValuesList[e.detail.index]={rotate:0,flipHorizontal:1,flipVertical:1})})},o.prototype.applyStyles=function(){var t=this.core.___slide[this.core.index].querySelector(".lg-img-rotate");utils.setVendor(t,"Transform","rotate("+this.rotateValuesList[this.core.index].rotate+"deg) scale3d("+this.rotateValuesList[this.core.index].flipHorizontal+", "+this.rotateValuesList[this.core.index].flipVertical+", 1)")},o.prototype.rotateLeft=function(){this.rotateValuesList[this.core.index].rotate-=90,this.applyStyles()},o.prototype.rotateRight=function(){this.rotateValuesList[this.core.index].rotate+=90,this.applyStyles()},o.prototype.getCurrentRotation=function(t){if(!t)return 0;var e=window.getComputedStyle(t,null),o=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("-moz-transform")||e.getPropertyValue("-ms-transform")||e.getPropertyValue("-o-transform")||e.getPropertyValue("transform")||"none";if("none"!==o){var r=o.split("(")[1].split(")")[0].split(",");if(r){var i=Math.round(Math.atan2(r[1],r[0])*(180/Math.PI));return i<0?i+360:i}}return 0},o.prototype.flipHorizontal=function(){var t=this.core.___slide[this.core.index].querySelector(".lg-img-rotate"),e=this.getCurrentRotation(t),o="flipHorizontal";90!==e&&270!==e||(o="flipVertical"),this.rotateValuesList[this.core.index][o]*=-1,this.applyStyles()},o.prototype.flipVertical=function(){var t=this.core.___slide[this.core.index].querySelector(".lg-img-rotate"),e=this.getCurrentRotation(t),o="flipVertical";90!==e&&270!==e||(o="flipHorizontal"),this.rotateValuesList[this.core.index][o]*=-1,this.applyStyles()},o.prototype.destroy=function(){utils.off(this.core.el,".lgtmrotate"),this.rotateValuesList={}},window.lgModules.Rotate=o})},{}]},{},[1])(1)});