// Globals var $window = $(window); var $document = $(document); var location = window.location; // Constants var NAMESPACE = 'cropper'; // Classes var CLASS_MODAL = 'cropper-modal'; var CLASS_HIDE = 'cropper-hide'; var CLASS_HIDDEN = 'cropper-hidden'; var CLASS_INVISIBLE = 'cropper-invisible'; var CLASS_MOVE = 'cropper-move'; var CLASS_CROP = 'cropper-crop'; var CLASS_DISABLED = 'cropper-disabled'; var CLASS_BG = 'cropper-bg'; // Events var EVENT_MOUSE_DOWN = 'mousedown touchstart pointerdown MSPointerDown'; var EVENT_MOUSE_MOVE = 'mousemove touchmove pointermove MSPointerMove'; var EVENT_MOUSE_UP = 'mouseup touchend touchcancel pointerup pointercancel MSPointerUp MSPointerCancel'; var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll'; var EVENT_DBLCLICK = 'dblclick'; var EVENT_LOAD = 'load.' + NAMESPACE; var EVENT_ERROR = 'error.' + NAMESPACE; var EVENT_RESIZE = 'resize.' + NAMESPACE; // Bind to window with namespace var EVENT_BUILD = 'build.' + NAMESPACE; var EVENT_BUILT = 'built.' + NAMESPACE; var EVENT_CROP_START = 'cropstart.' + NAMESPACE; var EVENT_CROP_MOVE = 'cropmove.' + NAMESPACE; var EVENT_CROP_END = 'cropend.' + NAMESPACE; var EVENT_CROP = 'crop.' + NAMESPACE; var EVENT_ZOOM = 'zoom.' + NAMESPACE; // RegExps var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/; // Data keys var DATA_PREVIEW = 'preview'; var DATA_ACTION = 'action'; // Actions var ACTION_EAST = 'e'; var ACTION_WEST = 'w'; var ACTION_SOUTH = 's'; var ACTION_NORTH = 'n'; var ACTION_SOUTH_EAST = 'se'; var ACTION_SOUTH_WEST = 'sw'; var ACTION_NORTH_EAST = 'ne'; var ACTION_NORTH_WEST = 'nw'; var ACTION_ALL = 'all'; var ACTION_CROP = 'crop'; var ACTION_MOVE = 'move'; var ACTION_ZOOM = 'zoom'; var ACTION_NONE = 'none'; // Supports var SUPPORT_CANVAS = $.isFunction($('')[0].getContext); // Maths var sqrt = Math.sqrt; var min = Math.min; var max = Math.max; var abs = Math.abs; var sin = Math.sin; var cos = Math.cos; var num = parseFloat; // Prototype var prototype = { version: '@VERSION' };