Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 09, 2014
@caleb reorganize image cropping/uncropping
split the CanvasImage class into its own file
956046a
@caleb add simple script to build the dist files b1e841e
Showing with 1,151 additions and 1,126 deletions.
  1. +5 −0 build.sh
  2. +189 −0 lib/canvas-image.coffee
  3. +0 −184 lib/drawing.coffee
  4. +2 −1 lib/rodeo-crop.coffee
  5. +954 −940 rodeo-crop.js
  6. +1 −1 rodeo-crop.min.js
View
5 build.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+rm -rf dist
+broccoli build dist
+mv dist/**/*.js .
View
189 lib/canvas-image.coffee
@@ -0,0 +1,189 @@
+`import drawing from "drawing"`
+
+class CanvasImage extends drawing.Drawable
+ constructor: (options) ->
+ super options
+
+ @source = options.source
+ @naturalWidth = options.naturalWidth
+ @naturalHeight = options.naturalHeight
+ @originalNaturalBounds = @naturalBounds()
+ @cropped = false
+ @history = []
+ @loaded = false
+
+ @cropX = 0
+ @cropY = 0
+ @cropWidth = @naturalWidth
+ @cropHeight = @naturalHeight
+
+ @loadImage()
+
+ clearImage: () ->
+ @loaded = false
+ @cropped = false
+ @w = null
+ @h = null
+ @naturalWidth = null
+ @naturalHeight = null
+ @history = []
+ @originalNaturalBounds = @naturalBounds()
+
+ @markDirty()
+
+ setSource: (source) ->
+ @clearImage()
+ @source = source
+ @loadImage()
+
+ naturalBounds: () ->
+ {
+ x: 0
+ y: 0
+ w: @naturalWidth
+ h: @naturalHeight
+ }
+
+ cropFrame: () ->
+ {
+ x: @cropX
+ y: @cropY
+ w: @cropWidth
+ h: @cropHeight
+ }
+
+ crop: (frame) ->
+ unless @cropped
+ @cropped = true
+ @cropX = @cropY = 0
+
+ previousCrop = @cropFrame()
+
+ @cropX = frame.x + @cropX
+ @cropY = frame.y + @cropY
+ @cropWidth = frame.width
+ @cropHeight = frame.height
+
+ @naturalWidth = @cropWidth
+ @naturalHeight = @cropHeight
+
+ @resizeToParent()
+ @centerOnParent()
+
+ @history.push
+ action: 'crop'
+ fromCropFrame: previousCrop
+ toCropFrame: @cropFrame()
+
+ @trigger 'crop', @, previousCrop, @cropFrame()
+
+ @markDirty()
+
+ undoCrop: () ->
+ if @history.length > 0
+ cropHistory = @history.pop()
+ newCropFrame = cropHistory.fromCropFrame
+
+ @cropX = newCropFrame.x
+ @cropY = newCropFrame.y
+ @cropWidth = newCropFrame.w
+ @cropHeight = newCropFrame.h
+ @naturalWidth = newCropFrame.w
+ @naturalHeight = newCropFrame.h
+
+ @resizeToParent()
+ @centerOnParent()
+
+ @cropped = false if @history.length == 0
+
+ @trigger 'crop', @, cropHistory.toCropFrame, @cropFrame()
+
+ @markDirty()
+
+ revertImage: () ->
+ @cropped = false
+
+ if @history.length > 0
+ cropHistory = @history.pop()
+
+ @cropX = 0
+ @cropY = 0
+ @cropWidth = @originalNaturalBounds.w
+ @cropHeight = @originalNaturalBounds.h
+ @naturalWidth = @originalNaturalBounds.w
+ @naturalHeight = @originalNaturalBounds.h
+
+ @resizeToParent()
+ @centerOnParent()
+
+ @trigger 'crop', @, cropHistory.toCropFrame, @cropFrame()
+
+ @history = []
+
+ @markDirty()
+
+ resizeToParent: () ->
+ cw = @parent.frame().w
+ ch = @parent.frame().h
+
+ scaleX = 1
+ scaleY = 1
+
+ scaleX = cw / @naturalWidth if @naturalWidth > cw
+ scaleY = ch / @naturalHeight if @naturalHeight > ch
+
+ @scale = Math.min scaleX, scaleY
+ @w = (@naturalWidth * @scale)|0
+ @h = (@naturalHeight * @scale)|0
+
+ @trigger 'resize', @frame()
+
+ centerOnParent: () ->
+ @x = ((@parent.frame().w / 2) - (@w / 2))|0
+ @y = ((@parent.frame().h / 2) - (@h / 2))|0
+
+ @trigger 'reposition', @frame()
+
+ toDataURL: (format = 'image/png') ->
+ canvas = document.createElement 'canvas'
+ canvas.width = @cropWidth
+ canvas.height = @cropHeight
+ ctx = canvas.getContext '2d'
+
+ if @cropped
+ ctx.drawImage @img, @cropX, @cropY, @cropWidth, @cropHeight, 0, 0, @cropWidth, @cropHeight
+ else
+ ctx.drawImage @img, 0, 0, @cropWidth, @cropHeight
+
+ canvas.toDataURL format
+
+ draw: (ctx) ->
+ @positionContext ctx, (ctx) ->
+ if @cropped
+ ctx.drawImage @img, @cropX, @cropY, @cropWidth, @cropHeight, 0, 0, @w, @h
+ else
+ ctx.drawImage @img, 0, 0, @w, @h
+
+ loadImage: ->
+ @img = document.createElement 'img'
+ @img.onload = =>
+ @loaded = true
+ @naturalWidth = @img.naturalWidth
+ @naturalHeight = @img.naturalHeight
+
+ @cropped = false
+ @history = []
+
+ @cropX = 0
+ @cropY = 0
+ @cropWidth = @img.naturalWidth
+ @cropHeight = @img.naturalHeight
+
+ @originalNaturalBounds = @naturalBounds()
+
+ @markDirty()
+
+ @trigger 'load', @
+ @img.src = @source
+
+`export default CanvasImage`
View
184 lib/drawing.coffee
@@ -214,190 +214,6 @@ class PaddedContainer extends Drawable
drawing.PaddedContainer = PaddedContainer
-class CanvasImage extends Drawable
- constructor: (options) ->
- super options
-
- @source = options.source
- @naturalWidth = options.naturalWidth
- @naturalHeight = options.naturalHeight
- @originalNaturalBounds = @naturalBounds()
- @cropped = false
- @cropStack = []
- @loaded = false
-
- @cropX = 0
- @cropY = 0
- @cropWidth = @naturalWidth
- @cropHeight = @naturalHeight
-
- @loadImage()
-
- clearImage: () ->
- @loaded = false
- @cropped = false
- @w = null
- @h = null
- @naturalWidth = null
- @naturalHeight = null
- @cropStack = []
- @originalNaturalBounds = @naturalBounds()
-
- @markDirty()
-
- setSource: (source) ->
- @clearImage()
- @source = source
- @loadImage()
-
- naturalBounds: () ->
- {
- x: 0
- y: 0
- w: @naturalWidth
- h: @naturalHeight
- }
-
- cropFrame: () ->
- {
- x: @cropX
- y: @cropY
- w: @cropWidth
- h: @cropHeight
- }
-
- crop: (frame) ->
- unless @cropped
- @cropped = true
- @cropX = @cropY = 0
-
- @cropX = frame.x + @cropX
- @cropY = frame.y + @cropY
- @cropWidth = frame.width
- @cropHeight = frame.height
-
- @naturalWidth = @cropWidth
- @naturalHeight = @cropHeight
-
- @resizeToParent()
- @centerOnParent()
-
- @cropStack.push @cropFrame()
-
- @trigger 'crop', @, @cropStack[@cropStack.length - 2], @cropFrame()
-
- @markDirty()
-
- undoCrop: () ->
- if @cropStack.length > 1
- previousCropFrame = @cropStack.pop()
- newCropFrame = @cropStack[@cropStack.length - 1]
-
- @cropX = newCropFrame.x
- @cropY = newCropFrame.y
- @cropWidth = newCropFrame.w
- @cropHeight = newCropFrame.h
- @naturalWidth = newCropFrame.w
- @naturalHeight = newCropFrame.h
-
- @resizeToParent()
- @centerOnParent()
-
- @cropped = false if @cropStack.length == 1
-
- @trigger 'crop', @, previousCropFrame, @cropFrame()
-
- @markDirty()
-
- revertImage: () ->
- @cropped = false
-
- if @cropStack.length > 1
- originalCropFrame = @cropStack[@cropStack.length - 1]
- newCropFrame = @cropStack[0]
-
- @cropX = newCropFrame.x
- @cropY = newCropFrame.y
- @cropWidth = newCropFrame.w
- @cropHeight = newCropFrame.h
- @naturalWidth = newCropFrame.w
- @naturalHeight = newCropFrame.h
-
- @resizeToParent()
- @centerOnParent()
-
- @cropStack = [newCropFrame]
-
- @trigger 'crop', @, originalCropFrame, newCropFrame
-
- @markDirty()
-
- resizeToParent: () ->
- cw = @parent.frame().w
- ch = @parent.frame().h
-
- scaleX = 1
- scaleY = 1
-
- scaleX = cw / @naturalWidth if @naturalWidth > cw
- scaleY = ch / @naturalHeight if @naturalHeight > ch
-
- @scale = Math.min scaleX, scaleY
- @w = (@naturalWidth * @scale)|0
- @h = (@naturalHeight * @scale)|0
-
- @trigger 'resize', @frame()
-
- centerOnParent: () ->
- @x = ((@parent.frame().w / 2) - (@w / 2))|0
- @y = ((@parent.frame().h / 2) - (@h / 2))|0
-
- @trigger 'reposition', @frame()
-
- toDataURL: (format = 'image/png') ->
- canvas = document.createElement 'canvas'
- canvas.width = @cropWidth
- canvas.height = @cropHeight
- ctx = canvas.getContext '2d'
-
- if @cropped
- ctx.drawImage @img, @cropX, @cropY, @cropWidth, @cropHeight, 0, 0, @cropWidth, @cropHeight
- else
- ctx.drawImage @img, 0, 0, @cropWidth, @cropHeight
-
- canvas.toDataURL format
-
- draw: (ctx) ->
- @positionContext ctx, (ctx) ->
- if @cropped
- ctx.drawImage @img, @cropX, @cropY, @cropWidth, @cropHeight, 0, 0, @w, @h
- else
- ctx.drawImage @img, 0, 0, @w, @h
-
- loadImage: ->
- @img = document.createElement 'img'
- @img.onload = =>
- @loaded = true
- @naturalWidth = @img.naturalWidth
- @naturalHeight = @img.naturalHeight
-
- @cropped = false
- @cropStack = []
-
- @cropX = 0
- @cropY = 0
- @cropWidth = @img.naturalWidth
- @cropHeight = @img.naturalHeight
-
- @cropStack.push @cropFrame()
-
- @markDirty()
-
- @trigger 'load', @
- @img.src = @source
-
-drawing.CanvasImage = CanvasImage
-
class Rectangle extends Drawable
constructor: (options) ->
super options
View
3 lib/rodeo-crop.coffee
@@ -1,6 +1,7 @@
`import _ from "funderscore"`
`import drawing from "drawing"`
`import Events from "events"`
+`import CanvasImage from "canvas-image"`
`import CropBox from "crop-box"`
`import Stage from "stage"`
@@ -54,7 +55,7 @@ class Cropper extends Events
@paddedContainer = new drawing.PaddedContainer
padding: (@options.handleSize / 2) + 1
- @image = new drawing.CanvasImage
+ @image = new CanvasImage
canvas: @canvas
source: @imageSource
View
1,894 rodeo-crop.js
954 additions, 940 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 rodeo-crop.min.js
@@ -1 +1 @@
-var define,requireModule,require,requirejs;!function(){var t={},e={};define=function(e,r,i){t[e]={deps:r,callback:i}},requirejs=require=requireModule=function(r){function i(t){if("."!==t.charAt(0))return t;for(var e=t.split("/"),i=r.split("/").slice(0,-1),n=0,s=e.length;s>n;n++){var o=e[n];if(".."===o)i.pop();else{if("."===o)continue;i.push(o)}}return i.join("/")}if(requirejs._eak_seen=t,e.hasOwnProperty(r))return e[r];if(e[r]={},!t[r])throw new Error("Could not find module "+r);for(var n,s=t[r],o=s.deps,a=s.callback,h=[],c=0,u=o.length;u>c;c++)h.push("exports"===o[c]?n={}:requireModule(i(o[c])));var p=a.apply(this,h);return e[r]=n||p}}(),define("crop-box",["funderscore","drawing","exports"],function(t,e,r){"use strict";var i,n=t["default"],s=e["default"],o={}.hasOwnProperty,a=function(t,e){function r(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};i=function(t){function e(t){e.__super__.constructor.call(this,n.extend({dragable:!0},t)),this.image=t.image,this.handleSize=t.handleSize||10,this.screenStyle=t.screenStyle||"rgba(0, 0, 0, .75)",this.topScreen=new s.Rectangle({fillStyle:this.screenStyle}),this.leftScreen=new s.Rectangle({fillStyle:this.screenStyle}),this.rightScreen=new s.Rectangle({fillStyle:this.screenStyle}),this.bottomScreen=new s.Rectangle({fillStyle:this.screenStyle}),this.cropX=t.cropX||0,this.cropY=t.cropY||0,this.cropWidth=t.cropWidth||4*this.handleSize,this.cropHeight=t.cropHeight||4*this.handleSize,this.marchingAnts=t.marchingAnts||!0,this.dashOffset=0,this.dragging=null,this.mouseDown=!1,this.handles={},this.image.on("load",function(t){return function(){return t.setCropFrameAndUpdateFrame(t.cropFrame())}}(this)),this.image.on("crop",function(t){return function(e,r,i){return t.cropX=r.w>=i.w?0:r.x-i.x,t.cropY=r.h>=i.h?0:r.y-i.y,t.cropWidth=r.w>=i.w?i.w:r.w,t.cropHeight=r.h>=i.h?i.h:r.h,t.setCropFrameAndUpdateFrame(t.cropFrame())}}(this)),this.on("mouseout",this.onMouseOut),this.on("mousemove",this.onMouseMove),this.on("mousedown",this.onMouseDown),this.on("mouseup",this.onMouseUp),this.on("dragstart",this.onDragStart),this.on("dragend",this.onDragEnd),this.on("dragmove",this.onDragMove),this.setLooseTheAnts()}return a(e,t),e.prototype.frame=function(){return{x:this.w<0?this.x+this.w:this.x,y:this.h<0?this.y+this.h:this.y,w:Math.abs(this.w),h:Math.abs(this.h)}},e.prototype.cropFrame=function(){return{x:this.cropX,y:this.cropY,width:this.cropWidth,height:this.cropHeight}},e.prototype.updateCropFrameFromFrame=function(){var t,e,r;return t=this.frame(),r=this.image.naturalBounds(),e=this.image.bounds(),this.image.loaded&&(this.cropX=r.w*(t.x/e.w),this.cropY=r.h*(t.y/e.h),this.cropWidth=r.w*(t.w/e.w),this.cropHeight=r.h*(t.h/e.h)),this.trigger("change:cropFrame",this.cropFrame())},e.prototype.setFrameAndUpdateCropArea=function(t){return this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h,this.updateCropFrameFromFrame(),this.markDirty()},e.prototype.updateFrameFromCropFrame=function(){var t,e;return this.image.loaded?(e=this.image.naturalBounds(),t=this.image.bounds(),this.x=t.w*(this.cropX/e.w),this.y=t.h*(this.cropY/e.h),this.w=t.w*(this.cropWidth/e.w),this.h=t.h*(this.cropHeight/e.h),this.markDirty()):void 0},e.prototype.setCropFrameAndUpdateFrame=function(t){var e,r,i,n,s;return this.image.loaded?(e=this.image.naturalBounds(),n=(null!=t?t.x:void 0)||.125*e.w,s=(null!=t?t.y:void 0)||.125*e.h,i=(null!=t?t.width:void 0)||.75*e.w,r=(null!=t?t.height:void 0)||.75*e.h,this.cropX=Math.min(Math.max(n,0),e.w),this.cropY=Math.min(Math.max(s,0),e.h),this.cropWidth=Math.min(Math.max(i,0),e.w-this.cropX),this.cropHeight=Math.min(Math.max(r,0),e.h-this.cropY),this.updateFrameFromCropFrame()):(this.cropX=null!=t?t.x:void 0,this.cropY=null!=t?t.y:void 0,this.cropWidth=null!=t?t.width:void 0,this.cropHeight=null!=t?t.height:void 0)},e.prototype.bounds=function(){return{x:0,y:0,w:Math.abs(this.w),h:Math.abs(this.h)}},e.prototype.containsCanvasPoint=function(t){var e,r,i,n,s;if(n=this.convertFromCanvas(t),e=this.containsPoint(n))return e;s=this.handles;for(r in s)if(i=s[r],i.containsCanvasPoint(t))return!0;return!1},e.prototype.onMouseOut=function(){return this.canvas.style.cursor="default"},e.prototype.onMouseMove=function(t){var e,r,i,n;if(this.enabled){i=t.canvasPoint,n=this.handles;for(e in n)if(r=n[e],r.containsCanvasPoint(i)){switch(e){case"tl":this.canvas.style.cursor="nw-resize";break;case"tm":this.canvas.style.cursor="n-resize";break;case"tr":this.canvas.style.cursor="ne-resize";break;case"ml":this.canvas.style.cursor="w-resize";break;case"mr":this.canvas.style.cursor="e-resize";break;case"bl":this.canvas.style.cursor="sw-resize";break;case"bm":this.canvas.style.cursor="s-resize";break;case"br":this.canvas.style.cursor="se-resize"}return}return this.canvas.style.cursor="move"}},e.prototype.constrainPointInParent=function(t){return{x:Math.min(Math.max(t.x,0),this.parent.frame().w),y:Math.min(Math.max(t.y,0),this.parent.frame().h)}},e.prototype.onMouseUp=function(){return this.dragging=this.mouseDown=null},e.prototype.onDragStart=function(t){var e,r,i,n,s;n=t.canvasPoint,s=this.handles;for(e in s)if(r=s[e],r.containsCanvasPoint(n))return i=r.convertFromCanvas(n),void(this.dragging={resizeDirection:e,object:r,offsetX:i.x,offsetY:i.y});return i=this.convertFromCanvas(n),this.dragging={object:this,offsetX:i.x,offsetY:i.y}},e.prototype.onDragMove=function(t){var e,r,i,n,s;if(i=t.canvasPoint,(null!=(n=this.dragging)?n.object:void 0)===this)return e=this.convertFromCanvas(i),this.moveTo({x:e.x-this.dragging.offsetX,y:e.y-this.dragging.offsetY}),this.updateCropFrameFromFrame(),this.markDirty();if(null!=(s=this.dragging)?s.resizeDirection:void 0){switch(r=this.parent.convertFromCanvas(i),this.dragging.resizeDirection){case"tl":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=this.h+(this.y-i.y),this.x=i.x,this.y=i.y;break;case"tm":i=this.constrainPointInParent(r),this.w=this.w,this.h=this.h+(this.y-i.y),this.x=this.x,this.y=i.y;break;case"tr":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=this.h+(this.y-i.y),this.x=this.x,this.y=i.y;break;case"ml":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=this.h,this.x=i.x,this.y=this.y;break;case"mr":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=this.h,this.x=this.x,this.y=this.y;break;case"bl":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=i.y-this.y,this.x=i.x,this.y=this.y;break;case"bm":i=this.constrainPointInParent(r),this.w=this.w,this.h=i.y-this.y,this.x=this.x,this.y=this.y;break;case"br":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=i.y-this.y,this.x=this.x,this.y=this.y}return this.updateCropFrameFromFrame(),this.markDirty()}},e.prototype.onDragEnd=function(t){var e,r;return r=t.canvasPoint,e=this.frame(),this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.trigger("change",this.cropFrame())},e.prototype.onClick=function(){},e.prototype.moveTo=function(t){var e,r,i;return e=this.convertToParent(t),r=Math.max(0,e.x),i=Math.max(0,e.y),r=Math.min(this.parent.bounds().w-this.w,r),i=Math.min(this.parent.bounds().h-this.h,i),this.x=r,this.y=i},e.prototype.setLooseTheAnts=function(){var t;return t=function(e){return function(){return e.marchingAnts&&(e.dashOffset+=.15,e.markDirty()),window.requestAnimationFrame(t)}}(this),window.requestAnimationFrame(t)},e.prototype.drawScreen=function(t){var e;return e=this.frame(),e.x=Math.round(e.x),e.y=Math.round(e.y),e.w=Math.round(e.w),e.h=Math.round(e.h),this.topScreen.set({parent:this.parent,x:0,y:0,w:this.parent.w,h:e.y}),this.bottomScreen.set({parent:this.parent,x:0,y:e.y+e.h,w:this.parent.w,h:this.parent.h-(e.y+e.h)}),this.leftScreen.set({parent:this.parent,x:0,y:e.y,w:e.x,h:e.h}),this.rightScreen.set({parent:this.parent,x:e.x+e.w,y:e.y,w:this.parent.w-(e.x+e.w),h:e.h}),this.topScreen.render(t),this.leftScreen.render(t),this.rightScreen.render(t),this.bottomScreen.render(t)},e.prototype.drawHandles=function(t){var e,r,i,n,o,a;r=this.frame(),r.x=Math.round(r.x),r.y=Math.round(r.y),r.w=Math.round(r.w),r.h=Math.round(r.h),n=function(t){return function(e,r){return new s.Rectangle({parent:t,x:e-t.handleSize/2-.5,y:r-t.handleSize/2-.5,w:t.handleSize,h:t.handleSize,lineWidth:1,strokeStyle:"rgba(192, 192, 192, 1)",fillStyle:"rgba(64, 64, 64, 1)"})}}(this),this.handles.tl=n(0,0),this.handles.tm=n(r.w/2,0),this.handles.tr=n(r.w,0),this.handles.ml=n(0,r.h/2),this.handles.mr=n(r.w,r.h/2),this.handles.bl=n(0,r.h),this.handles.bm=n(r.w/2,r.h),this.handles.br=n(r.w,r.h),o=this.handles,a=[];for(e in o)i=o[e],a.push(i.render(t));return a},e.prototype.drawCropLines=function(t){var e,r,i;return e=this.frame(),e.x=Math.round(e.x),e.y=Math.round(e.y),e.w=Math.round(e.w),e.h=Math.round(e.h),i="0.5",r=4,t.save(),this.positionContext(t,function(t){return function(n){var s,o,a,h,c,u,p,l,d;for(n.lineDashOffset=t.dashOffset,n.beginPath(),n.strokeStyle="rgba(255,255,255,1)",n.rect(.5,.5,e.w,e.h),n.closePath(),n.stroke(),n.beginPath(),n.strokeStyle="rgba(0,0,0,1)",n.setLineDash([r]),n.rect(.5,.5,e.w,e.h),n.closePath(),n.stroke(),n.lineDashOffset=0,p=[e.w/3+.5,e.w/3*2+.5],a=0,c=p.length;c>a;a++)s=p[a],n.beginPath(),n.moveTo(s,0),n.strokeStyle="rgba(255,255,255,"+i+")",n.setLineDash([]),n.lineTo(s,e.h),n.stroke(),n.beginPath(),n.moveTo(s,0),n.strokeStyle="rgba(0,0,0,"+i+")",n.setLineDash([r]),n.lineTo(s,e.h),n.stroke();for(l=[e.h/3+.5,e.h/3*2+.5],d=[],h=0,u=l.length;u>h;h++)o=l[h],n.beginPath(),n.moveTo(0,o),n.strokeStyle="rgba(255,255,255,"+i+")",n.setLineDash([]),n.lineTo(e.w,o),n.stroke(),n.beginPath(),n.moveTo(0,o),n.strokeStyle="rgba(0,0,0,"+i+")",n.setLineDash([r]),n.lineTo(e.w,o),d.push(n.stroke());return d}}(this)),t.restore()},e.prototype.draw=function(t){return this.drawScreen(t),this.drawCropLines(t),this.drawHandles(t)},e}(s.Drawable),r["default"]=i}),define("funderscore",["exports"],function(t){"use strict";var e,r,i,n,s,o;for(r={},r.clone=function(t){return r.extend({},t)},r.extend=function(t,e){var r;if(e)for(r in e)t[r]=e[r];return t},o=["Arguments","Function","String","Number","Date","RegExp"],i=function(t){return r["is"+t]=function(e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},n=0,s=o.length;s>n;n++)e=o[n],i(e);t["default"]=r}),define("drawing",["funderscore","events","exports"],function(t,e,r){"use strict";var i,n,s,o,a,h=t["default"],c=e["default"],u={}.hasOwnProperty,p=function(t,e){function r(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l=[].slice;a={},n=function(t){function e(t){this.options=t,this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h,this.dirty=!0,this.scale=t.scale,this.parent=t.parent,this.canvas=t.canvas,this.children=t.children||[],this.dragable=t.dragable||!1,this.enabled=void 0!==t.enabled?!!t.enabled:!0}return p(e,t),e.prototype.set=function(t){var e,r,i;i=[];for(e in t)u.call(t,e)&&(r=t[e],i.push(this[e]=r));return i},e.prototype.enable=function(t){var e;return e=this.enabled,this.enabled=!!t,this.markDirty(),e!==this.enabled?this.enabled?this.trigger("enabled",this):this.trigger("disabled",this):void 0},e.prototype.markDirty=function(){return this.dirty=!0,this.parent?this.parent.markDirty():void 0},e.prototype.bubble=function(){var t,e,r,i,n;for(r=arguments[0],e=arguments[1],t=3<=arguments.length?l.call(arguments,2):[],e.currentTarget=this,this.trigger.apply(this,arguments),i=this.parent,n=[];i;)e=h.clone(e),e.currentTarget=i,i.trigger.apply(i,[r,e].concat(t)),n.push(i=i.parent);return n},e.prototype.findChildAtPoint=function(t){var e,r,i;for(i=this.children.length-1;i>=0;){if(e=this.children[i],r=e.findChildAtPoint(t))return r;if(e.containsCanvasPoint(t))return e;i--}},e.prototype.bounds=function(){return{x:0,y:0,w:this.w,h:this.h}},e.prototype.frame=function(){return{x:this.x,y:this.y,w:this.w,h:this.h}},e.prototype.convertToParent=function(t){var e;return e=this.frame(),{x:t.x+e.x,y:t.y+e.y}},e.prototype.convertFromParent=function(t){var e;return e=this.frame(),{x:t.x-e.x,y:t.y-e.y}},e.prototype.convertToCanvas=function(t){var e,r,i;for(e=this,r=t.x,i=t.y;e;)r+=e.frame().x,i+=e.frame().y,e=e.parent;return{x:r,y:i}},e.prototype.convertFromCanvas=function(t){var e,r,i;for(e=this,r=t.x,i=t.y;e;)r-=e.frame().x,i-=e.frame().y,e=e.parent;return{x:r,y:i}},e.prototype.positionContext=function(t,e){var r;return this.parent&&(r=this.convertToCanvas(this.parent.bounds()),t.translate(r.x,r.y)),e.call(this,t)},e.prototype.containsCanvasPoint=function(t){var e;return e=this.convertFromCanvas(t),this.containsPoint(e)},e.prototype.containsPoint=function(t){var e,r,i;return e=this.frame(),0<=(r=t.x)&&r<=e.w&&0<=(i=t.y)&&i<=e.h},e.prototype.addChild=function(t){return t.parent=this,this.children.push(t),this.markDirty()},e.prototype.removeChild=function(t){var e;return e=this.children.indexOf(t),e>=0?(t.parent=null,this.children.splice(e,1),this.markDirty()):void 0},e.prototype.renderChildren=function(t){var e,r,i,n,s;for(n=this.children,s=[],r=0,i=n.length;i>r;r++)e=n[r],s.push(e.enabled?e.render(t):void 0);return s},e.prototype.clear=function(t){var e;return e=this.frame(),this.parent?positionContext(t,function(){return function(t){return t.clearRect(e.x,e.y,e.w,e.h)}}(this)):t.clearRect(e.x,e.y,e.w,e.h)},e.prototype.render=function(t){return t.save(),this.draw(t),t.restore(),this.renderChildren(t),this.dirty=!1},e.prototype.draw=function(){},e}(c),a.Drawable=n,s=function(t){function e(t){null==t&&(t={}),e.__super__.constructor.call(this,t),this.padding=t.padding||10,this.fillParent=t.fillParent||!0}return p(e,t),e.prototype.frame=function(){var t;return this.fillParent?(t=this.parent.frame(),{x:this.padding,y:this.padding,w:t.w-2*this.padding,h:t.h-2*this.padding}):{x:this.x+this.padding,y:this.y+this.padding,w:this.w-2*this.padding,h:this.h-2*this.padding}},e.prototype.bounds=function(){var t;return this.fillParent?(t=this.parent.frame(),{x:0,y:0,w:t.w-2*this.padding,h:t.h-2*this.padding}):{x:0,y:0,w:this.w-2*this.padding,h:this.h-2*this.padding}},e}(n),a.PaddedContainer=s,i=function(t){function e(t){e.__super__.constructor.call(this,t),this.source=t.source,this.naturalWidth=t.naturalWidth,this.naturalHeight=t.naturalHeight,this.originalNaturalBounds=this.naturalBounds(),this.cropped=!1,this.cropStack=[],this.loaded=!1,this.cropX=0,this.cropY=0,this.cropWidth=this.naturalWidth,this.cropHeight=this.naturalHeight,this.loadImage()}return p(e,t),e.prototype.clearImage=function(){return this.loaded=!1,this.cropped=!1,this.w=null,this.h=null,this.naturalWidth=null,this.naturalHeight=null,this.cropStack=[],this.originalNaturalBounds=this.naturalBounds(),this.markDirty()},e.prototype.setSource=function(t){return this.clearImage(),this.source=t,this.loadImage()},e.prototype.naturalBounds=function(){return{x:0,y:0,w:this.naturalWidth,h:this.naturalHeight}},e.prototype.cropFrame=function(){return{x:this.cropX,y:this.cropY,w:this.cropWidth,h:this.cropHeight}},e.prototype.crop=function(t){return this.cropped||(this.cropped=!0,this.cropX=this.cropY=0),this.cropX=t.x+this.cropX,this.cropY=t.y+this.cropY,this.cropWidth=t.width,this.cropHeight=t.height,this.naturalWidth=this.cropWidth,this.naturalHeight=this.cropHeight,this.resizeToParent(),this.centerOnParent(),this.cropStack.push(this.cropFrame()),this.trigger("crop",this,this.cropStack[this.cropStack.length-2],this.cropFrame()),this.markDirty()},e.prototype.undoCrop=function(){var t,e;return this.cropStack.length>1?(e=this.cropStack.pop(),t=this.cropStack[this.cropStack.length-1],this.cropX=t.x,this.cropY=t.y,this.cropWidth=t.w,this.cropHeight=t.h,this.naturalWidth=t.w,this.naturalHeight=t.h,this.resizeToParent(),this.centerOnParent(),1===this.cropStack.length&&(this.cropped=!1),this.trigger("crop",this,e,this.cropFrame()),this.markDirty()):void 0},e.prototype.revertImage=function(){var t,e;return this.cropped=!1,this.cropStack.length>1?(e=this.cropStack[this.cropStack.length-1],t=this.cropStack[0],this.cropX=t.x,this.cropY=t.y,this.cropWidth=t.w,this.cropHeight=t.h,this.naturalWidth=t.w,this.naturalHeight=t.h,this.resizeToParent(),this.centerOnParent(),this.cropStack=[t],this.trigger("crop",this,e,t),this.markDirty()):void 0},e.prototype.resizeToParent=function(){var t,e,r,i;return e=this.parent.frame().w,t=this.parent.frame().h,r=1,i=1,this.naturalWidth>e&&(r=e/this.naturalWidth),this.naturalHeight>t&&(i=t/this.naturalHeight),this.scale=Math.min(r,i),this.w=this.naturalWidth*this.scale|0,this.h=this.naturalHeight*this.scale|0,this.trigger("resize",this.frame())},e.prototype.centerOnParent=function(){return this.x=this.parent.frame().w/2-this.w/2|0,this.y=this.parent.frame().h/2-this.h/2|0,this.trigger("reposition",this.frame())},e.prototype.toDataURL=function(t){var e,r;return null==t&&(t="image/png"),e=document.createElement("canvas"),e.width=this.cropWidth,e.height=this.cropHeight,r=e.getContext("2d"),this.cropped?r.drawImage(this.img,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight):r.drawImage(this.img,0,0,this.cropWidth,this.cropHeight),e.toDataURL(t)},e.prototype.draw=function(t){return this.positionContext(t,function(t){return this.cropped?t.drawImage(this.img,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.w,this.h):t.drawImage(this.img,0,0,this.w,this.h)})},e.prototype.loadImage=function(){return this.img=document.createElement("img"),this.img.onload=function(t){return function(){return t.loaded=!0,t.naturalWidth=t.img.naturalWidth,t.naturalHeight=t.img.naturalHeight,t.cropped=!1,t.cropStack=[],t.cropX=0,t.cropY=0,t.cropWidth=t.img.naturalWidth,t.cropHeight=t.img.naturalHeight,t.cropStack.push(t.cropFrame()),t.markDirty(),t.trigger("load",t)}}(this),this.img.src=this.source},e}(n),a.CanvasImage=i,o=function(t){function e(t){e.__super__.constructor.call(this,t),this.fillStyle=t.fillStyle||"rgba(0, 0, 0, 0)",this.strokeStyle=t.strokeStyle,this.lineWidth=t.lineWidth}return p(e,t),e.prototype.draw=function(t){return this.positionContext(t,function(t){return function(e){return t.fillStyle&&(e.fillStyle=t.fillStyle),t.strokeStyle&&(e.strokeStyle=t.strokeStyle),t.lineWidth&&(e.lineWidth=t.lineWidth),e.beginPath(),e.rect(0,0,t.w,t.h),e.closePath(),t.fillStyle&&e.fill(),t.lineWidth&&t.strokeStyle?e.stroke():void 0}}(this))},e}(n),a.Rectangle=o,r["default"]=a}),define("events",["funderscore","exports"],function(t,e){"use strict";var r,i,n=t["default"];i=function(){function t(){}return t.prototype.on=function(t,e,r){var i;return this.events||(this.events={}),(i=this.events)[t]||(i[t]=[]),n.isFunction(e)?this.events[t].push([e,r]):void 0},t.prototype.trigger=function(t){var e,r,i,n,s,o,a,h;for(s=Array.prototype.slice.call(arguments,1),i=this.events&&this.events[t]?this.events[t]:[],h=[],o=0,a=i.length;a>o;o++)r=i[o],e=r[0],n=r[1]||this,h.push(e.apply(n,s));return h},t}(),r=function(){function t(t){var e,r;for(e in t)r=t[e],this[e]=r}return t}(),e["default"]=i,e.Event=r}),define("rodeo-crop",["funderscore","drawing","events","crop-box","stage","exports"],function(t,e,r,i,n,s){"use strict";var o,a,h=t["default"],c=e["default"],u=r["default"],p=i["default"],l=n["default"],d={}.hasOwnProperty,g=function(t,e){function r(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};a={},o=function(t){function e(t,e){this.el=h.isString(t)?document.querySelector(t):t,this.options=h.extend({cropEnabled:!0,cropX:null,cropY:null,cropWidth:null,cropHeight:null,marchingAnts:!0,handleSize:10,width:100,height:100,imageSource:null},e),this.ctx=null,this.stage=null,this.imageSource=this.options.imageSource,this.initializeCanvas(),this.createStage(),this.createImage(),this.createCropBox(),this.runLoop()}return g(e,t),e.prototype.initializeCanvas=function(){return this.canvas=document.createElement("canvas"),this.canvas.width=this.options.width,this.canvas.height=this.options.height,this.canvas.style.display="block",this.el.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")},e.prototype.createStage=function(){return this.stage=new l({canvas:this.canvas})},e.prototype.createImage=function(){return this.paddedContainer=new c.PaddedContainer({padding:this.options.handleSize/2+1}),this.image=new c.CanvasImage({canvas:this.canvas,source:this.imageSource}),this.image.on("load",function(t){return function(){return t.image.resizeToParent(),t.image.centerOnParent()}}(this)),this.stage.on("resize",function(t){return function(){return t.image.resizeToParent(),t.image.centerOnParent()}}(this)),this.paddedContainer.addChild(this.image),this.stage.addChild(this.paddedContainer)},e.prototype.createCropBox=function(){return this.cropBox=new p({enabled:this.options.cropEnabled,canvas:this.canvas,image:this.image,cropX:this.options.cropX,cropY:this.options.cropY,cropWidth:this.options.cropWidth,cropHeight:this.options.cropHeight,handleSize:this.options.handleSize,marchingAnts:this.options.marchingAnts}),this.cropBox.on("disabled",function(t){return function(e){return t.trigger("disabled",e)}}(this)),this.cropBox.on("enabled",function(t){return function(e){return t.trigger("enabled",e)}}(this)),this.cropBox.on("change",function(t){return function(e){return t.trigger("change",e)}}(this)),this.image.on("resize",function(t){return function(){return t.cropBox.updateFrameFromCropFrame()}}(this)),this.image.addChild(this.cropBox)},e.prototype.isCropped=function(){return this.image.cropped},e.prototype.setImageSource=function(t){return this.image.setSource(t)},e.prototype.setCropFrame=function(t){return this.cropBox.setCropFrameAndUpdateFrame(t),this.cropBox.cropFrame()},e.prototype.enableCrop=function(t){return this.cropBox.enable(t)},e.prototype.revertImage=function(){return this.image.revertImage()},e.prototype.undoCropImage=function(){return this.image.undoCrop()},e.prototype.cropImage=function(){return this.cropBox.enabled?this.image.crop(this.cropBox.cropFrame()):void 0},e.prototype.toDataURL=function(t){return null==t&&(t="image/png"),this.image.toDataURL(t)},e.prototype.updateCanvasSize=function(){var t,e;return e=window.getComputedStyle(this.canvas.parentNode).getPropertyValue("width"),t=window.getComputedStyle(this.canvas.parentNode).getPropertyValue("height"),e=parseInt(e,10),t=parseInt(t,10),this.canvas.width!==e||this.canvas.height!==t?(this.canvas.width=e,this.canvas.height=t,!0):!1},e.prototype.runLoop=function(){var t;return t=this.updateCanvasSize(),(t||this.stage.dirty)&&(this.stage.clear(this.ctx),t&&this.stage.trigger("resize"),this.stage.render(this.ctx)),window.requestAnimationFrame(function(t){return function(){return t.runLoop()}}(this))},e}(u),a.Cropper=o,s["default"]=a}),define("stage",["funderscore","drawing","events","exports"],function(t,e,r,i){"use strict";var n,s=(t["default"],e["default"]),o=r.Event,a={}.hasOwnProperty,h=function(t,e){function r(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};n=function(t){function e(t){e.__super__.constructor.call(this,t),this.canvas=t.canvas,this.lastMouseDownTarget=null,this.lastMouseMoveTarget=null,this.dragTarget=null,this.clickTarget=null,this.attachListeners()}return h(e,t),e.prototype.bubbleMouseEvent=function(t,e,r,i){var n;return n=new o({target:t,originalEvent:r,canvasPoint:i}),t.bubble(e,n)},e.prototype.attachListeners=function(){return this.canvas.addEventListener("mouseup",function(t){return function(e){var r,i;if(1===e.which)return r=t.windowToCanvas(e),i=t.findChildAtPoint(r)||t,t.bubbleMouseEvent(i,"mouseup",e,r),t.clickTarget===i&&t.bubbleMouseEvent(t.clickTarget,"click",e,r),t.lastMouseDownTarget=null,t.lastMouseMoveTarget=null,t.clickTarget=null}}(this)),this.canvas.addEventListener("mousedown",function(t){return function(e){var r,i,n,s;if(1===e.which)return n=t.windowToCanvas(e),s=t.findChildAtPoint(n)||t,t.bubbleMouseEvent(s,"mousedown",e,n),t.lastMouseDownTarget=s,t.clickTarget=s,t.movedSinceMouseDown=!1,r=function(e){return e.preventDefault(),n=t.windowToCanvas(e),t.lastMouseDownTarget?(t.dragTarget||(t.bubbleMouseEvent(t.lastMouseDownTarget,"dragstart",e,n),t.dragTarget=t.lastMouseDownTarget),t.bubbleMouseEvent(t.dragTarget,"dragmove",e,n)):void 0},i=function(e){return e.preventDefault(),t.dragTarget&&(n=t.windowToCanvas(e),t.bubbleMouseEvent(t.dragTarget,"dragend",e,n)),t.lastMouseDownTarget=null,t.lastMouseMoveTarget=null,t.dragTarget=null,t.canvasContainsWindowPoint(e)||(t.clickTarget=null),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",i)},window.addEventListener("mousemove",r),window.addEventListener("mouseup",i)}}(this)),this.canvas.addEventListener("mouseout",function(t){return function(e){var r;return r=t.windowToCanvas(e),t.lastMouseMoveTarget?t.bubbleMouseEvent(t.lastMouseMoveTarget,"mouseout",e,r):void 0}}(this)),this.canvas.addEventListener("mousemove",function(t){return function(e){var r,i;return r=t.windowToCanvas(e),i=t.findChildAtPoint(r)||t,t.bubbleMouseEvent(i,"mousemove",e,r),i!==t.lastMouseMoveTarget&&(t.lastMouseMoveTarget&&t.bubbleMouseEvent(t.lastMouseMoveTarget,"mouseout",e,r),t.bubbleMouseEvent(i,"mouseover",e,r)),t.lastMouseMoveTarget=i}}(this))},e.prototype.canvasContainsWindowPoint=function(t){var e;return e=this.canvas.getBoundingClientRect(),t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom},e.prototype.windowToCanvas=function(t){var e,r,i;return e=this.canvas.getBoundingClientRect(),r=t.clientX-e.left-parseInt(window.getComputedStyle(this.canvas).getPropertyValue("padding-left"),0),i=t.clientY-e.top-parseInt(window.getComputedStyle(this.canvas).getPropertyValue("padding-top"),0),{x:r,y:i}},e.prototype.frame=function(){return{x:0,y:0,w:this.canvas.width,h:this.canvas.height}},e.prototype.bounds=function(){return this.frame()},e}(s.Drawable),i["default"]=n}),define("vendor/loader",[],function(){"use strict";var t,e,r,i;!function(){var n={},s={};t=function(t,e,r){n[t]={deps:e,callback:r}},i=r=e=function(t){function r(e){if("."!==e.charAt(0))return e;for(var r=e.split("/"),i=t.split("/").slice(0,-1),n=0,s=r.length;s>n;n++){var o=r[n];if(".."===o)i.pop();else{if("."===o)continue;i.push(o)}}return i.join("/")}if(i._eak_seen=n,s.hasOwnProperty(t))return s[t];if(s[t]={},!n[t])throw new Error("Could not find module "+t);for(var o,a=n[t],h=a.deps,c=a.callback,u=[],p=0,l=h.length;l>p;p++)u.push("exports"===h[p]?o={}:e(r(h[p])));var d=c.apply(this,u);return s[t]=o||d}}()}),window.RodeoCrop=requireModule("rodeo-crop").default;
+var define,requireModule,require,requirejs;!function(){var t={},e={};define=function(e,r,i){t[e]={deps:r,callback:i}},requirejs=require=requireModule=function(r){function i(t){if("."!==t.charAt(0))return t;for(var e=t.split("/"),i=r.split("/").slice(0,-1),n=0,o=e.length;o>n;n++){var s=e[n];if(".."===s)i.pop();else{if("."===s)continue;i.push(s)}}return i.join("/")}if(requirejs._eak_seen=t,e.hasOwnProperty(r))return e[r];if(e[r]={},!t[r])throw new Error("Could not find module "+r);for(var n,o=t[r],s=o.deps,a=o.callback,h=[],u=0,c=s.length;c>u;u++)h.push("exports"===s[u]?n={}:requireModule(i(s[u])));var p=a.apply(this,h);return e[r]=n||p}}(),define("canvas-image",["drawing","exports"],function(t,e){"use strict";var r,i=t["default"],n={}.hasOwnProperty,o=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};r=function(t){function e(t){e.__super__.constructor.call(this,t),this.source=t.source,this.naturalWidth=t.naturalWidth,this.naturalHeight=t.naturalHeight,this.originalNaturalBounds=this.naturalBounds(),this.cropped=!1,this.history=[],this.loaded=!1,this.cropX=0,this.cropY=0,this.cropWidth=this.naturalWidth,this.cropHeight=this.naturalHeight,this.loadImage()}return o(e,t),e.prototype.clearImage=function(){return this.loaded=!1,this.cropped=!1,this.w=null,this.h=null,this.naturalWidth=null,this.naturalHeight=null,this.history=[],this.originalNaturalBounds=this.naturalBounds(),this.markDirty()},e.prototype.setSource=function(t){return this.clearImage(),this.source=t,this.loadImage()},e.prototype.naturalBounds=function(){return{x:0,y:0,w:this.naturalWidth,h:this.naturalHeight}},e.prototype.cropFrame=function(){return{x:this.cropX,y:this.cropY,w:this.cropWidth,h:this.cropHeight}},e.prototype.crop=function(t){var e;return this.cropped||(this.cropped=!0,this.cropX=this.cropY=0),e=this.cropFrame(),this.cropX=t.x+this.cropX,this.cropY=t.y+this.cropY,this.cropWidth=t.width,this.cropHeight=t.height,this.naturalWidth=this.cropWidth,this.naturalHeight=this.cropHeight,this.resizeToParent(),this.centerOnParent(),this.history.push({action:"crop",fromCropFrame:e,toCropFrame:this.cropFrame()}),this.trigger("crop",this,e,this.cropFrame()),this.markDirty()},e.prototype.undoCrop=function(){var t,e;return this.history.length>0?(t=this.history.pop(),e=t.fromCropFrame,this.cropX=e.x,this.cropY=e.y,this.cropWidth=e.w,this.cropHeight=e.h,this.naturalWidth=e.w,this.naturalHeight=e.h,this.resizeToParent(),this.centerOnParent(),0===this.history.length&&(this.cropped=!1),this.trigger("crop",this,t.toCropFrame,this.cropFrame()),this.markDirty()):void 0},e.prototype.revertImage=function(){var t;return this.cropped=!1,this.history.length>0?(t=this.history.pop(),this.cropX=0,this.cropY=0,this.cropWidth=this.originalNaturalBounds.w,this.cropHeight=this.originalNaturalBounds.h,this.naturalWidth=this.originalNaturalBounds.w,this.naturalHeight=this.originalNaturalBounds.h,this.resizeToParent(),this.centerOnParent(),this.trigger("crop",this,t.toCropFrame,this.cropFrame()),this.history=[],this.markDirty()):void 0},e.prototype.resizeToParent=function(){var t,e,r,i;return e=this.parent.frame().w,t=this.parent.frame().h,r=1,i=1,this.naturalWidth>e&&(r=e/this.naturalWidth),this.naturalHeight>t&&(i=t/this.naturalHeight),this.scale=Math.min(r,i),this.w=this.naturalWidth*this.scale|0,this.h=this.naturalHeight*this.scale|0,this.trigger("resize",this.frame())},e.prototype.centerOnParent=function(){return this.x=this.parent.frame().w/2-this.w/2|0,this.y=this.parent.frame().h/2-this.h/2|0,this.trigger("reposition",this.frame())},e.prototype.toDataURL=function(t){var e,r;return null==t&&(t="image/png"),e=document.createElement("canvas"),e.width=this.cropWidth,e.height=this.cropHeight,r=e.getContext("2d"),this.cropped?r.drawImage(this.img,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight):r.drawImage(this.img,0,0,this.cropWidth,this.cropHeight),e.toDataURL(t)},e.prototype.draw=function(t){return this.positionContext(t,function(t){return this.cropped?t.drawImage(this.img,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.w,this.h):t.drawImage(this.img,0,0,this.w,this.h)})},e.prototype.loadImage=function(){return this.img=document.createElement("img"),this.img.onload=function(t){return function(){return t.loaded=!0,t.naturalWidth=t.img.naturalWidth,t.naturalHeight=t.img.naturalHeight,t.cropped=!1,t.history=[],t.cropX=0,t.cropY=0,t.cropWidth=t.img.naturalWidth,t.cropHeight=t.img.naturalHeight,t.originalNaturalBounds=t.naturalBounds(),t.markDirty(),t.trigger("load",t)}}(this),this.img.src=this.source},e}(i.Drawable),e["default"]=r}),define("drawing",["funderscore","events","exports"],function(t,e,r){"use strict";var i,n,o,s,a=t["default"],h=e["default"],u={}.hasOwnProperty,c=function(t,e){function r(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p=[].slice;s={},i=function(t){function e(t){this.options=t,this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h,this.dirty=!0,this.scale=t.scale,this.parent=t.parent,this.canvas=t.canvas,this.children=t.children||[],this.dragable=t.dragable||!1,this.enabled=void 0!==t.enabled?!!t.enabled:!0}return c(e,t),e.prototype.set=function(t){var e,r,i;i=[];for(e in t)u.call(t,e)&&(r=t[e],i.push(this[e]=r));return i},e.prototype.enable=function(t){var e;return e=this.enabled,this.enabled=!!t,this.markDirty(),e!==this.enabled?this.enabled?this.trigger("enabled",this):this.trigger("disabled",this):void 0},e.prototype.markDirty=function(){return this.dirty=!0,this.parent?this.parent.markDirty():void 0},e.prototype.bubble=function(){var t,e,r,i,n;for(r=arguments[0],e=arguments[1],t=3<=arguments.length?p.call(arguments,2):[],e.currentTarget=this,this.trigger.apply(this,arguments),i=this.parent,n=[];i;)e=a.clone(e),e.currentTarget=i,i.trigger.apply(i,[r,e].concat(t)),n.push(i=i.parent);return n},e.prototype.findChildAtPoint=function(t){var e,r,i;for(i=this.children.length-1;i>=0;){if(e=this.children[i],r=e.findChildAtPoint(t))return r;if(e.containsCanvasPoint(t))return e;i--}},e.prototype.bounds=function(){return{x:0,y:0,w:this.w,h:this.h}},e.prototype.frame=function(){return{x:this.x,y:this.y,w:this.w,h:this.h}},e.prototype.convertToParent=function(t){var e;return e=this.frame(),{x:t.x+e.x,y:t.y+e.y}},e.prototype.convertFromParent=function(t){var e;return e=this.frame(),{x:t.x-e.x,y:t.y-e.y}},e.prototype.convertToCanvas=function(t){var e,r,i;for(e=this,r=t.x,i=t.y;e;)r+=e.frame().x,i+=e.frame().y,e=e.parent;return{x:r,y:i}},e.prototype.convertFromCanvas=function(t){var e,r,i;for(e=this,r=t.x,i=t.y;e;)r-=e.frame().x,i-=e.frame().y,e=e.parent;return{x:r,y:i}},e.prototype.positionContext=function(t,e){var r;return this.parent&&(r=this.convertToCanvas(this.parent.bounds()),t.translate(r.x,r.y)),e.call(this,t)},e.prototype.containsCanvasPoint=function(t){var e;return e=this.convertFromCanvas(t),this.containsPoint(e)},e.prototype.containsPoint=function(t){var e,r,i;return e=this.frame(),0<=(r=t.x)&&r<=e.w&&0<=(i=t.y)&&i<=e.h},e.prototype.addChild=function(t){return t.parent=this,this.children.push(t),this.markDirty()},e.prototype.removeChild=function(t){var e;return e=this.children.indexOf(t),e>=0?(t.parent=null,this.children.splice(e,1),this.markDirty()):void 0},e.prototype.renderChildren=function(t){var e,r,i,n,o;for(n=this.children,o=[],r=0,i=n.length;i>r;r++)e=n[r],o.push(e.enabled?e.render(t):void 0);return o},e.prototype.clear=function(t){var e;return e=this.frame(),this.parent?positionContext(t,function(){return function(t){return t.clearRect(e.x,e.y,e.w,e.h)}}(this)):t.clearRect(e.x,e.y,e.w,e.h)},e.prototype.render=function(t){return t.save(),this.draw(t),t.restore(),this.renderChildren(t),this.dirty=!1},e.prototype.draw=function(){},e}(h),s.Drawable=i,n=function(t){function e(t){null==t&&(t={}),e.__super__.constructor.call(this,t),this.padding=t.padding||10,this.fillParent=t.fillParent||!0}return c(e,t),e.prototype.frame=function(){var t;return this.fillParent?(t=this.parent.frame(),{x:this.padding,y:this.padding,w:t.w-2*this.padding,h:t.h-2*this.padding}):{x:this.x+this.padding,y:this.y+this.padding,w:this.w-2*this.padding,h:this.h-2*this.padding}},e.prototype.bounds=function(){var t;return this.fillParent?(t=this.parent.frame(),{x:0,y:0,w:t.w-2*this.padding,h:t.h-2*this.padding}):{x:0,y:0,w:this.w-2*this.padding,h:this.h-2*this.padding}},e}(i),s.PaddedContainer=n,o=function(t){function e(t){e.__super__.constructor.call(this,t),this.fillStyle=t.fillStyle||"rgba(0, 0, 0, 0)",this.strokeStyle=t.strokeStyle,this.lineWidth=t.lineWidth}return c(e,t),e.prototype.draw=function(t){return this.positionContext(t,function(t){return function(e){return t.fillStyle&&(e.fillStyle=t.fillStyle),t.strokeStyle&&(e.strokeStyle=t.strokeStyle),t.lineWidth&&(e.lineWidth=t.lineWidth),e.beginPath(),e.rect(0,0,t.w,t.h),e.closePath(),t.fillStyle&&e.fill(),t.lineWidth&&t.strokeStyle?e.stroke():void 0}}(this))},e}(i),s.Rectangle=o,r["default"]=s}),define("funderscore",["exports"],function(t){"use strict";var e,r,i,n,o,s;for(r={},r.clone=function(t){return r.extend({},t)},r.extend=function(t,e){var r;if(e)for(r in e)t[r]=e[r];return t},s=["Arguments","Function","String","Number","Date","RegExp"],i=function(t){return r["is"+t]=function(e){return Object.prototype.toString.call(e)==="[object "+t+"]"}},n=0,o=s.length;o>n;n++)e=s[n],i(e);t["default"]=r}),define("events",["funderscore","exports"],function(t,e){"use strict";var r,i,n=t["default"];i=function(){function t(){}return t.prototype.on=function(t,e,r){var i;return this.events||(this.events={}),(i=this.events)[t]||(i[t]=[]),n.isFunction(e)?this.events[t].push([e,r]):void 0},t.prototype.trigger=function(t){var e,r,i,n,o,s,a,h;for(o=Array.prototype.slice.call(arguments,1),i=this.events&&this.events[t]?this.events[t]:[],h=[],s=0,a=i.length;a>s;s++)r=i[s],e=r[0],n=r[1]||this,h.push(e.apply(n,o));return h},t}(),r=function(){function t(t){var e,r;for(e in t)r=t[e],this[e]=r}return t}(),e["default"]=i,e.Event=r}),define("crop-box",["funderscore","drawing","exports"],function(t,e,r){"use strict";var i,n=t["default"],o=e["default"],s={}.hasOwnProperty,a=function(t,e){function r(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};i=function(t){function e(t){e.__super__.constructor.call(this,n.extend({dragable:!0},t)),this.image=t.image,this.handleSize=t.handleSize||10,this.screenStyle=t.screenStyle||"rgba(0, 0, 0, .75)",this.topScreen=new o.Rectangle({fillStyle:this.screenStyle}),this.leftScreen=new o.Rectangle({fillStyle:this.screenStyle}),this.rightScreen=new o.Rectangle({fillStyle:this.screenStyle}),this.bottomScreen=new o.Rectangle({fillStyle:this.screenStyle}),this.cropX=t.cropX||0,this.cropY=t.cropY||0,this.cropWidth=t.cropWidth||4*this.handleSize,this.cropHeight=t.cropHeight||4*this.handleSize,this.marchingAnts=t.marchingAnts||!0,this.dashOffset=0,this.dragging=null,this.mouseDown=!1,this.handles={},this.image.on("load",function(t){return function(){return t.setCropFrameAndUpdateFrame(t.cropFrame())}}(this)),this.image.on("crop",function(t){return function(e,r,i){return t.cropX=r.w>=i.w?0:r.x-i.x,t.cropY=r.h>=i.h?0:r.y-i.y,t.cropWidth=r.w>=i.w?i.w:r.w,t.cropHeight=r.h>=i.h?i.h:r.h,t.setCropFrameAndUpdateFrame(t.cropFrame())}}(this)),this.on("mouseout",this.onMouseOut),this.on("mousemove",this.onMouseMove),this.on("mousedown",this.onMouseDown),this.on("mouseup",this.onMouseUp),this.on("dragstart",this.onDragStart),this.on("dragend",this.onDragEnd),this.on("dragmove",this.onDragMove),this.setLooseTheAnts()}return a(e,t),e.prototype.frame=function(){return{x:this.w<0?this.x+this.w:this.x,y:this.h<0?this.y+this.h:this.y,w:Math.abs(this.w),h:Math.abs(this.h)}},e.prototype.cropFrame=function(){return{x:this.cropX,y:this.cropY,width:this.cropWidth,height:this.cropHeight}},e.prototype.updateCropFrameFromFrame=function(){var t,e,r;return t=this.frame(),r=this.image.naturalBounds(),e=this.image.bounds(),this.image.loaded&&(this.cropX=r.w*(t.x/e.w),this.cropY=r.h*(t.y/e.h),this.cropWidth=r.w*(t.w/e.w),this.cropHeight=r.h*(t.h/e.h)),this.trigger("change:cropFrame",this.cropFrame())},e.prototype.setFrameAndUpdateCropArea=function(t){return this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h,this.updateCropFrameFromFrame(),this.markDirty()},e.prototype.updateFrameFromCropFrame=function(){var t,e;return this.image.loaded?(e=this.image.naturalBounds(),t=this.image.bounds(),this.x=t.w*(this.cropX/e.w),this.y=t.h*(this.cropY/e.h),this.w=t.w*(this.cropWidth/e.w),this.h=t.h*(this.cropHeight/e.h),this.markDirty()):void 0},e.prototype.setCropFrameAndUpdateFrame=function(t){var e,r,i,n,o;return this.image.loaded?(e=this.image.naturalBounds(),n=(null!=t?t.x:void 0)||.125*e.w,o=(null!=t?t.y:void 0)||.125*e.h,i=(null!=t?t.width:void 0)||.75*e.w,r=(null!=t?t.height:void 0)||.75*e.h,this.cropX=Math.min(Math.max(n,0),e.w),this.cropY=Math.min(Math.max(o,0),e.h),this.cropWidth=Math.min(Math.max(i,0),e.w-this.cropX),this.cropHeight=Math.min(Math.max(r,0),e.h-this.cropY),this.updateFrameFromCropFrame()):(this.cropX=null!=t?t.x:void 0,this.cropY=null!=t?t.y:void 0,this.cropWidth=null!=t?t.width:void 0,this.cropHeight=null!=t?t.height:void 0)},e.prototype.bounds=function(){return{x:0,y:0,w:Math.abs(this.w),h:Math.abs(this.h)}},e.prototype.containsCanvasPoint=function(t){var e,r,i,n,o;if(n=this.convertFromCanvas(t),e=this.containsPoint(n))return e;o=this.handles;for(r in o)if(i=o[r],i.containsCanvasPoint(t))return!0;return!1},e.prototype.onMouseOut=function(){return this.canvas.style.cursor="default"},e.prototype.onMouseMove=function(t){var e,r,i,n;if(this.enabled){i=t.canvasPoint,n=this.handles;for(e in n)if(r=n[e],r.containsCanvasPoint(i)){switch(e){case"tl":this.canvas.style.cursor="nw-resize";break;case"tm":this.canvas.style.cursor="n-resize";break;case"tr":this.canvas.style.cursor="ne-resize";break;case"ml":this.canvas.style.cursor="w-resize";break;case"mr":this.canvas.style.cursor="e-resize";break;case"bl":this.canvas.style.cursor="sw-resize";break;case"bm":this.canvas.style.cursor="s-resize";break;case"br":this.canvas.style.cursor="se-resize"}return}return this.canvas.style.cursor="move"}},e.prototype.constrainPointInParent=function(t){return{x:Math.min(Math.max(t.x,0),this.parent.frame().w),y:Math.min(Math.max(t.y,0),this.parent.frame().h)}},e.prototype.onMouseUp=function(){return this.dragging=this.mouseDown=null},e.prototype.onDragStart=function(t){var e,r,i,n,o;n=t.canvasPoint,o=this.handles;for(e in o)if(r=o[e],r.containsCanvasPoint(n))return i=r.convertFromCanvas(n),void(this.dragging={resizeDirection:e,object:r,offsetX:i.x,offsetY:i.y});return i=this.convertFromCanvas(n),this.dragging={object:this,offsetX:i.x,offsetY:i.y}},e.prototype.onDragMove=function(t){var e,r,i,n,o;if(i=t.canvasPoint,(null!=(n=this.dragging)?n.object:void 0)===this)return e=this.convertFromCanvas(i),this.moveTo({x:e.x-this.dragging.offsetX,y:e.y-this.dragging.offsetY}),this.updateCropFrameFromFrame(),this.markDirty();if(null!=(o=this.dragging)?o.resizeDirection:void 0){switch(r=this.parent.convertFromCanvas(i),this.dragging.resizeDirection){case"tl":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=this.h+(this.y-i.y),this.x=i.x,this.y=i.y;break;case"tm":i=this.constrainPointInParent(r),this.w=this.w,this.h=this.h+(this.y-i.y),this.x=this.x,this.y=i.y;break;case"tr":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=this.h+(this.y-i.y),this.x=this.x,this.y=i.y;break;case"ml":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=this.h,this.x=i.x,this.y=this.y;break;case"mr":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=this.h,this.x=this.x,this.y=this.y;break;case"bl":i=this.constrainPointInParent(r),this.w=this.w+(this.x-i.x),this.h=i.y-this.y,this.x=i.x,this.y=this.y;break;case"bm":i=this.constrainPointInParent(r),this.w=this.w,this.h=i.y-this.y,this.x=this.x,this.y=this.y;break;case"br":i=this.constrainPointInParent(r),this.w=i.x-this.x,this.h=i.y-this.y,this.x=this.x,this.y=this.y}return this.updateCropFrameFromFrame(),this.markDirty()}},e.prototype.onDragEnd=function(t){var e,r;return r=t.canvasPoint,e=this.frame(),this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.trigger("change",this.cropFrame())},e.prototype.onClick=function(){},e.prototype.moveTo=function(t){var e,r,i;return e=this.convertToParent(t),r=Math.max(0,e.x),i=Math.max(0,e.y),r=Math.min(this.parent.bounds().w-this.w,r),i=Math.min(this.parent.bounds().h-this.h,i),this.x=r,this.y=i},e.prototype.setLooseTheAnts=function(){var t;return t=function(e){return function(){return e.marchingAnts&&(e.dashOffset+=.15,e.markDirty()),window.requestAnimationFrame(t)}}(this),window.requestAnimationFrame(t)},e.prototype.drawScreen=function(t){var e;return e=this.frame(),e.x=Math.round(e.x),e.y=Math.round(e.y),e.w=Math.round(e.w),e.h=Math.round(e.h),this.topScreen.set({parent:this.parent,x:0,y:0,w:this.parent.w,h:e.y}),this.bottomScreen.set({parent:this.parent,x:0,y:e.y+e.h,w:this.parent.w,h:this.parent.h-(e.y+e.h)}),this.leftScreen.set({parent:this.parent,x:0,y:e.y,w:e.x,h:e.h}),this.rightScreen.set({parent:this.parent,x:e.x+e.w,y:e.y,w:this.parent.w-(e.x+e.w),h:e.h}),this.topScreen.render(t),this.leftScreen.render(t),this.rightScreen.render(t),this.bottomScreen.render(t)},e.prototype.drawHandles=function(t){var e,r,i,n,s,a;r=this.frame(),r.x=Math.round(r.x),r.y=Math.round(r.y),r.w=Math.round(r.w),r.h=Math.round(r.h),n=function(t){return function(e,r){return new o.Rectangle({parent:t,x:e-t.handleSize/2-.5,y:r-t.handleSize/2-.5,w:t.handleSize,h:t.handleSize,lineWidth:1,strokeStyle:"rgba(192, 192, 192, 1)",fillStyle:"rgba(64, 64, 64, 1)"})}}(this),this.handles.tl=n(0,0),this.handles.tm=n(r.w/2,0),this.handles.tr=n(r.w,0),this.handles.ml=n(0,r.h/2),this.handles.mr=n(r.w,r.h/2),this.handles.bl=n(0,r.h),this.handles.bm=n(r.w/2,r.h),this.handles.br=n(r.w,r.h),s=this.handles,a=[];for(e in s)i=s[e],a.push(i.render(t));return a},e.prototype.drawCropLines=function(t){var e,r,i;return e=this.frame(),e.x=Math.round(e.x),e.y=Math.round(e.y),e.w=Math.round(e.w),e.h=Math.round(e.h),i="0.5",r=4,t.save(),this.positionContext(t,function(t){return function(n){var o,s,a,h,u,c,p,l,d;for(n.lineDashOffset=t.dashOffset,n.beginPath(),n.strokeStyle="rgba(255,255,255,1)",n.rect(.5,.5,e.w,e.h),n.closePath(),n.stroke(),n.beginPath(),n.strokeStyle="rgba(0,0,0,1)",n.setLineDash([r]),n.rect(.5,.5,e.w,e.h),n.closePath(),n.stroke(),n.lineDashOffset=0,p=[e.w/3+.5,e.w/3*2+.5],a=0,u=p.length;u>a;a++)o=p[a],n.beginPath(),n.moveTo(o,0),n.strokeStyle="rgba(255,255,255,"+i+")",n.setLineDash([]),n.lineTo(o,e.h),n.stroke(),n.beginPath(),n.moveTo(o,0),n.strokeStyle="rgba(0,0,0,"+i+")",n.setLineDash([r]),n.lineTo(o,e.h),n.stroke();for(l=[e.h/3+.5,e.h/3*2+.5],d=[],h=0,c=l.length;c>h;h++)s=l[h],n.beginPath(),n.moveTo(0,s),n.strokeStyle="rgba(255,255,255,"+i+")",n.setLineDash([]),n.lineTo(e.w,s),n.stroke(),n.beginPath(),n.moveTo(0,s),n.strokeStyle="rgba(0,0,0,"+i+")",n.setLineDash([r]),n.lineTo(e.w,s),d.push(n.stroke());return d}}(this)),t.restore()},e.prototype.draw=function(t){return this.drawScreen(t),this.drawCropLines(t),this.drawHandles(t)},e}(o.Drawable),r["default"]=i}),define("rodeo-crop",["funderscore","drawing","events","canvas-image","crop-box","stage","exports"],function(t,e,r,i,n,o,s){"use strict";var a,h,u=t["default"],c=e["default"],p=r["default"],l=i["default"],d=n["default"],g=o["default"],f={}.hasOwnProperty,y=function(t,e){function r(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};h={},a=function(t){function e(t,e){this.el=u.isString(t)?document.querySelector(t):t,this.options=u.extend({cropEnabled:!0,cropX:null,cropY:null,cropWidth:null,cropHeight:null,marchingAnts:!0,handleSize:10,width:100,height:100,imageSource:null},e),this.ctx=null,this.stage=null,this.imageSource=this.options.imageSource,this.initializeCanvas(),this.createStage(),this.createImage(),this.createCropBox(),this.runLoop()}return y(e,t),e.prototype.initializeCanvas=function(){return this.canvas=document.createElement("canvas"),this.canvas.width=this.options.width,this.canvas.height=this.options.height,this.canvas.style.display="block",this.el.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")},e.prototype.createStage=function(){return this.stage=new g({canvas:this.canvas})},e.prototype.createImage=function(){return this.paddedContainer=new c.PaddedContainer({padding:this.options.handleSize/2+1}),this.image=new l({canvas:this.canvas,source:this.imageSource}),this.image.on("load",function(t){return function(){return t.image.resizeToParent(),t.image.centerOnParent()}}(this)),this.stage.on("resize",function(t){return function(){return t.image.resizeToParent(),t.image.centerOnParent()}}(this)),this.paddedContainer.addChild(this.image),this.stage.addChild(this.paddedContainer)},e.prototype.createCropBox=function(){return this.cropBox=new d({enabled:this.options.cropEnabled,canvas:this.canvas,image:this.image,cropX:this.options.cropX,cropY:this.options.cropY,cropWidth:this.options.cropWidth,cropHeight:this.options.cropHeight,handleSize:this.options.handleSize,marchingAnts:this.options.marchingAnts}),this.cropBox.on("disabled",function(t){return function(e){return t.trigger("disabled",e)}}(this)),this.cropBox.on("enabled",function(t){return function(e){return t.trigger("enabled",e)}}(this)),this.cropBox.on("change",function(t){return function(e){return t.trigger("change",e)}}(this)),this.image.on("resize",function(t){return function(){return t.cropBox.updateFrameFromCropFrame()}}(this)),this.image.addChild(this.cropBox)},e.prototype.isCropped=function(){return this.image.cropped},e.prototype.setImageSource=function(t){return this.image.setSource(t)},e.prototype.setCropFrame=function(t){return this.cropBox.setCropFrameAndUpdateFrame(t),this.cropBox.cropFrame()},e.prototype.enableCrop=function(t){return this.cropBox.enable(t)},e.prototype.revertImage=function(){return this.image.revertImage()},e.prototype.undoCropImage=function(){return this.image.undoCrop()},e.prototype.cropImage=function(){return this.cropBox.enabled?this.image.crop(this.cropBox.cropFrame()):void 0},e.prototype.toDataURL=function(t){return null==t&&(t="image/png"),this.image.toDataURL(t)},e.prototype.updateCanvasSize=function(){var t,e;return e=window.getComputedStyle(this.canvas.parentNode).getPropertyValue("width"),t=window.getComputedStyle(this.canvas.parentNode).getPropertyValue("height"),e=parseInt(e,10),t=parseInt(t,10),this.canvas.width!==e||this.canvas.height!==t?(this.canvas.width=e,this.canvas.height=t,!0):!1},e.prototype.runLoop=function(){var t;return t=this.updateCanvasSize(),(t||this.stage.dirty)&&(this.stage.clear(this.ctx),t&&this.stage.trigger("resize"),this.stage.render(this.ctx)),window.requestAnimationFrame(function(t){return function(){return t.runLoop()}}(this))},e}(p),h.Cropper=a,s["default"]=h}),define("stage",["funderscore","drawing","events","exports"],function(t,e,r,i){"use strict";var n,o=(t["default"],e["default"]),s=r.Event,a={}.hasOwnProperty,h=function(t,e){function r(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};n=function(t){function e(t){e.__super__.constructor.call(this,t),this.canvas=t.canvas,this.lastMouseDownTarget=null,this.lastMouseMoveTarget=null,this.dragTarget=null,this.clickTarget=null,this.attachListeners()}return h(e,t),e.prototype.bubbleMouseEvent=function(t,e,r,i){var n;return n=new s({target:t,originalEvent:r,canvasPoint:i}),t.bubble(e,n)},e.prototype.attachListeners=function(){return this.canvas.addEventListener("mouseup",function(t){return function(e){var r,i;if(1===e.which)return r=t.windowToCanvas(e),i=t.findChildAtPoint(r)||t,t.bubbleMouseEvent(i,"mouseup",e,r),t.clickTarget===i&&t.bubbleMouseEvent(t.clickTarget,"click",e,r),t.lastMouseDownTarget=null,t.lastMouseMoveTarget=null,t.clickTarget=null}}(this)),this.canvas.addEventListener("mousedown",function(t){return function(e){var r,i,n,o;if(1===e.which)return n=t.windowToCanvas(e),o=t.findChildAtPoint(n)||t,t.bubbleMouseEvent(o,"mousedown",e,n),t.lastMouseDownTarget=o,t.clickTarget=o,t.movedSinceMouseDown=!1,r=function(e){return e.preventDefault(),n=t.windowToCanvas(e),t.lastMouseDownTarget?(t.dragTarget||(t.bubbleMouseEvent(t.lastMouseDownTarget,"dragstart",e,n),t.dragTarget=t.lastMouseDownTarget),t.bubbleMouseEvent(t.dragTarget,"dragmove",e,n)):void 0},i=function(e){return e.preventDefault(),t.dragTarget&&(n=t.windowToCanvas(e),t.bubbleMouseEvent(t.dragTarget,"dragend",e,n)),t.lastMouseDownTarget=null,t.lastMouseMoveTarget=null,t.dragTarget=null,t.canvasContainsWindowPoint(e)||(t.clickTarget=null),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",i)},window.addEventListener("mousemove",r),window.addEventListener("mouseup",i)}}(this)),this.canvas.addEventListener("mouseout",function(t){return function(e){var r;return r=t.windowToCanvas(e),t.lastMouseMoveTarget?t.bubbleMouseEvent(t.lastMouseMoveTarget,"mouseout",e,r):void 0}}(this)),this.canvas.addEventListener("mousemove",function(t){return function(e){var r,i;return r=t.windowToCanvas(e),i=t.findChildAtPoint(r)||t,t.bubbleMouseEvent(i,"mousemove",e,r),i!==t.lastMouseMoveTarget&&(t.lastMouseMoveTarget&&t.bubbleMouseEvent(t.lastMouseMoveTarget,"mouseout",e,r),t.bubbleMouseEvent(i,"mouseover",e,r)),t.lastMouseMoveTarget=i}}(this))},e.prototype.canvasContainsWindowPoint=function(t){var e;return e=this.canvas.getBoundingClientRect(),t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom},e.prototype.windowToCanvas=function(t){var e,r,i;return e=this.canvas.getBoundingClientRect(),r=t.clientX-e.left-parseInt(window.getComputedStyle(this.canvas).getPropertyValue("padding-left"),0),i=t.clientY-e.top-parseInt(window.getComputedStyle(this.canvas).getPropertyValue("padding-top"),0),{x:r,y:i}},e.prototype.frame=function(){return{x:0,y:0,w:this.canvas.width,h:this.canvas.height}},e.prototype.bounds=function(){return this.frame()},e}(o.Drawable),i["default"]=n}),define("vendor/loader",[],function(){"use strict";var t,e,r,i;!function(){var n={},o={};t=function(t,e,r){n[t]={deps:e,callback:r}},i=r=e=function(t){function r(e){if("."!==e.charAt(0))return e;for(var r=e.split("/"),i=t.split("/").slice(0,-1),n=0,o=r.length;o>n;n++){var s=r[n];if(".."===s)i.pop();else{if("."===s)continue;i.push(s)}}return i.join("/")}if(i._eak_seen=n,o.hasOwnProperty(t))return o[t];if(o[t]={},!n[t])throw new Error("Could not find module "+t);for(var s,a=n[t],h=a.deps,u=a.callback,c=[],p=0,l=h.length;l>p;p++)c.push("exports"===h[p]?s={}:e(r(h[p])));var d=u.apply(this,c);return o[t]=s||d}}()}),window.RodeoCrop=requireModule("rodeo-crop").default;

No commit comments for this range

Something went wrong with that request. Please try again.