VimUnDoіgҔ!@$f\%<, _T3:L_T0zA1resizeSensor = require '../../utils/ResizeSensor'5_T0zA7elementResizeEvent = require '../../utils/ResizeSensor'5_ T0z A* resizeSensor(@getDOMNode(), @onResize)5_T0B A5_T0C B5_#8v8T0C console.log C5_ #8v8T0( D  C5_  '#8v8T0')H ')G5_  &(#8v8T0S%'H/ height: "#{imageWidth*1/2}px"5_ &*#8v8T0W%'H/ height: "#{imageWidth*4/2}px"5_(##8v8T0O(*I (*H5_&(#8v8T09%'I/ height: "#{imageWidth*4/5}px"5_8%#8v8T2 8:J 8:I5_8#8v8T2  8;K 8:J5_;#8v8T2p:;( console.log imageCount, imagesPerRow5_#8v8T2r  console.log @state5_ #8v8T2 K  J5_&(#8v8T2%'K/ height: "#{imageWidth*3/5}px"5_&(#8v8T2%'K. height: "#{imageWidth*/5}px"5_&(#8v8T2%'K- height: "#{imageWidth*5}px"5_&(#8v8T2 %'K, height: "#{imageWidth*}px"5_ #8v8T2VL K5_"#8v8T2hLA
5_ #8v8T2 L heightWidthRatio: 3/55_#'/#8v8T2&(LC height: "#{imageWidth*@props.heightWidthRatio}px"5_$# #8v8T29 L widthHeightRatio: 3/55_#%$ #8v8T2: L widthHeightRatio: 3/5_$&% #8v8T2: L widthHeightRatio: 35_%'& #8v8T2: L widthHeightRatio: 5_&('#8v8T2M L5_')(#8v8T2! 5_(*)#8v8T2"M5_)+*#8v8T2% O  N5_*,+#8v8T2? O( children: React.PropTypes.isRequired5_+-,< #8v8T2^<>O5_,.-#8v8T2n console.log @props5_-/.#8v8T2o( console.log @calculateImageWidth()5_.0/N#8v8T2M. @setState width: @getDOMNode().offsetWidth5_/10#8v8T2N if @state.width isnt 05_021:%#8v8T29;N> imagesPerRow = Math.round(@state.width/@props.targetWidth)5_132C#8v8T2BDN* rawWidth = @state.width / imagesPerRow5_243#8v8T2kON5_354!#8v8T2}PO5_465#8v8T2Ѐ mixins5_576#8v8T2ЀP O5_687#8v8T2ЋP @onResize()0 elementResizeEvent(@getDOMNode(), @onResize)5_8:9VT2Й3elementResizeEvent = require 'element-resize-event'5_9;:IKIVT2ЛHI onResize: ->7 @setState componentWidth: @getDOMNode().offsetWidth5_:K;IIVT2]"I H5_;L<KJJVT2ڑ# console.log @state5_KML4IIVT246I 46H5_LNM66&G&V&T2>5HI1 # Calculate the # of images per row to place.6 imageCount = React.Children.count(@props.children)G imagesPerRow = Math.round(@state.componentWidth/@props.targetWidth)1 # There has to be at least one image per row., imagesPerRow = Math.max(imagesPerRow, 1) if imagesPerRow > imageCount imagesPerRow = imageCount= # Calculate the per-image width with space for in-between # images subtracted3 rawWidth = @state.componentWidth / imagesPerRowW marginRightOffset = ((@props.margin * imagesPerRow) - @props.margin) / imagesPerRow4 imageWidth = rawWidth - marginRightOffset - 0.25 # Don't get too big.U maxWidth = if @props.maxWidth? then @props.maxWidth else @props.targetWidth * 1.5/ imageWidth = Math.min(imageWidth, maxWidth)5_MON86&G&V&T2G8:J 8:I5_NPOH+6&H&V&T2SHKK HJJ5_OQPH6&H&V&T2\HJM HJL5_PRQI6&H&V&T2fHJM [imagesPerRow, 5_QSRI6&H&V&T2fHJM [imagesPerRow 5_RTSI6&H&V&T2gHJM [imagesPerRow5_SUTI6&H&V&T2hHJM [imagesPerRow]5_TVUK6&H&V&T2nJLM _calcImageWidth5_UWVK 6&H&V&T2xKNN KMM5_VXWK6&H&V&T2JLO0 [imageWidth, imagesPerRow] = _calcImageWidth5_WYXI6&H&V&T2HJO [imageWidth, imagesPerRow]5_XZYM6&H&V&T2LNO if imageWidth5_Y[ZM$6&H&V&T2MOOMNO5_Z\[N6&H&V&T2MOPC [imageWidth, imagesPerRow, marginRightOffset] = _calcImageWidth5_[]\NE6&H&V&T2MOPE [imageWidth, imagesPerRow, marginRightOffset] = _calcImageWidth5_\^]KC6&H&V&T2JLPC [imageWidth, imagesPerRow, marginRightOffset] = _calcImageWidth5_]_^J6&H&V&T2$JLQ JLP5_^`_5%6&H&V&T2%46Q' _calcImageWidth = (refineUp = 0) ->5__a`I6&H&V&T2&HJQ3 [imageWidth, imagesPerRow, marginRightOffset]5_`baH 6&H&V&T2'HJR HJQ5_acbL6&H&V&T2'KL! console.log marginRightOffset5_bdcL6&H&V&T2'(LNQLMQ5_cedM6&H&V&T2LNR! console.log marginRightOffset5_dfeM46&H&V&T2)LNR4 console.log "total margin: " + marginRightOffset5_egfO%6&H&V&T2*NPR% if imageWidth < marginRightOffset5_fhgP36&H&V&T2PRRPQR5_gihQ6&H&V&T2PRSC console.log "total margin: " + marginRightOffset * imagesPerRow5_hjiQ6&H&V&T2+PRSE console.log "total margin: " + marginRightOffset * imagesPerRow5_ikj8&6&H&V&T28:T 8:S5_jlk:6&I&V&T2,:<T:;T5_kml:"6&J&V&T29;U, imagesPerRow = imagesPerRow + refineUp5_lnm:$6&J&V&T29;U, imagesPerRow = imagesPerRow - refineUp5_mon56&J&V&T246U' _calcImageWidth = (refineUp = 0) =>5_npo56&J&V&T246U) _calcImageWidth = (adjustDown = 0) =>5_oqp:$6&J&V&T2-9;U. imagesPerRow = imagesPerRow - refineDown5_prqS6&J&V&T2RSM console.log "total margin round 2: " + marginRightOffset * imagesPerRow5_qsr96&J&V&T289 console.log imagesPerRow5_rts:6&I&V&T29: console.log imagesPerRow5_sutI6&H&V&T2HI= console.log imageWidth, imagesPerRow, marginRightOffset5_tvuL6&H&V&T2KLC console.log "total margin: " + marginRightOffset * imagesPerRow5_uwvL6&H&V&T2.LOQ LNP5_vxwO6&H&V&T2LOQS OQR5_wyxP6&H&V&T2jOQS= Math.round(marginRightOffset*imagesPerRow % imageWidth)5_xzyQF6&H&V&T2mPRSH [imageWidth, imagesPerRow, marginRightOffset] = _calcImageWidth(1)5_y{zQF6&H&V&T2m/PRSG [imageWidth, imagesPerRow, marginRightOffset] = _calcImageWidth()5_z|{PI6&H&V&T2q0PRT PRS5_{}|O)6&H&V&T2OQU OQT5_|~}PQQHvHT2OQU console.log PQU5_}~P<QQHvHT2PRUPQU5_~QRRHvHT2QSVQRV5_P0P<P0v0T2OQW= console.log marginRightOffset*imagesPerRow % imageWidth5_RP<P0v0T21QR= console.log marginRightOffset*imagesPerRow % imageWidth5_PP<P0v0T22PRW PRV5_R1P<P0v0T2QSW= console.log marginRightOffset*imagesPerRow % imageWidth5_R0P<P0v0T2QSW= console.log marginRightOffset*imagesPerRow / imageWidth5_RP<P0v0T2QSW= console.log marginRightOffset*imagesPerRow)/ imageWidth5_R3P<P0v0T2QSW> console.log (marginRightOffset*imagesPerRow)/ imageWidth5_S=P<P0v0T2RTWJ adjustment = Math.round(marginRightOffset*imagesPerRow % imageWidth)5_S<P<P0v0T2RTWJ adjustment = Math.round(marginRightOffset*imagesPerRow / imageWidth)5_S>P<P0v0T2RTWJ adjustment = Math.round(marginRightOffset*imagesPerRow)/ imageWidth)5_SP<P0v0T23RTWI adjustment = Math.round(marginRightOffset*imagesPerRow)/imageWidth)5_TP<P0v0T2>ST* console.log "adjustment", adjustment5_PQPVT2?OP0 console.log marginRightOffset*imagesPerRow console.log imageWidth5_PPPVT2@OP= console.log (marginRightOffset*imagesPerRow)/imageWidth5_NNNvT2KMOS # per row by one.5_N NNvT2L4MOS # per row .5_NNvT3W5T S5_OOvT3p6 console.log @state5_))*VT3y()4 "margin-right": "#{marginRight}px"7 "margin-bottom": "#{@props.margin}px"5_&))VT3z&)Q&'Q5_*++VT3{7*,T *,S5_-,,VT3(},.T }, child)5_  vT3(T< {React.Children.map(@props.children, (child, i) =>5_ vT3(T) {@props.children, (child, i) =>5_ vT3(T+ {@props.images.map, (child, i) =>5_ vT3(T* {@props.images.map (child, i) =>5_  vT3(T( {@props.images.map (img, i) =>5_" vT3(T) {@props.images.map (imag, i) =>5_-$ vT3(,.T& }, React.DOM.img({src: )5_-, vT3(8,.T. }, React.DOM.img({src: image}) )5_/  vT3)9.0T )}5_  vT3)] T, children: React.PropTypes.any.isRequired5_  vT3)_: T* images: React.PropTypes.any.isRequired5_  vT3);U T5_ vT3*<V U5_ vT3*W=W V5_ vT3*}X W5_ vT3*?X) console.log @getDOMNode().offsetWidth5_<<<'v'T3*;=X8 imageCount = React.Children.count(@props.children)5_<"<<'v'T3*;=X# imageCount = @props.children)5_<<<'v'T3*@;=X" imageCount = @props.children5_<<'v'T3* console.log @state5_;;'v'T3*+ console.log @getDOMNode().offsetWidth5_::'v'T3*A* console.log imageWidth, imagesPerRow5_99'v'T3*B if @isMounted()5_ 88'v'T30xT* {@props.images.map (image, i) =>5_ 99'v'T30yU+ @props.images.map (image, i) =>5_ 99'v'T30zU {5_199'v'T31CU1 { # Loop over each image and create an 5_(99'v'T311"V !U5_00+0vT31A/1W- }, React.DOM.img({src: image}))5_00+0vT31A/1W }, )5_!0+0vT31G "W/ image = React.DOM.img({src: image})5_00+0vT31JD/1W }, image)5_ 0+0vT31WE { # Loop over each image and create the image grid element.5_ 1+1vT31XE # Loop over each image and create the image grid element.5_ 1+1vT31GX { 5_ 2 V T32"H3XC # Loop over each image and create the image grid element.) @props.images.map (image, i) => if imagesPerRow is 1 marginRight = 0< else if i isnt 0 and (i + 1) % imagesPerRow is 0 marginRight = 0 else) marginRight = @props.margin1 imageEl = React.DOM.img({src: image}) return ( React.DOM.div({* className: "image-wrapper" style: {* width: "#{imageWidth}px"C height: "#{imageWidth*@props.widthHeightRatio}px") display: "inline-block"4 "margin-right": "#{marginRight}px"7 "margin-bottom": "#{@props.margin}px"$ overflow: "hidden"& position: "relative") "vertical-align": "top" } }, imageEl) )5_ 2 V T32YX5_" 3 V T32"$Z "$Y5_$ 4 V T32#%Z3 imageEl = React.DOM.img({src: image})5_$ 4 V T32$'[ $&Z5_& 6 V T32%&5_% 5 V T32$&[ else5_%% 5 V T32%'\ %'[5_&8 6 V T32%'\D imageEl = =LLVT2J K* child.props.width = imageWidth5_=?>*LLVT2 K1 child.props.width = imageWidth + "px"5_>@?LLVT2)K) console.log child, imageWidth5_?A@vT2ذK5 console.log child, child.type, imageWidth5_@BAvT2K. console.log child.type, imageWidth5_ACBvT2 K L( React.addons.cloneWithProps(5_BDC(vT2 LH React.addons.cloneWithProps(child, width: imageWidth + "px")5_CED vT2LP child = React.addons.cloneWithProps(child, width: imageWidth + "px")5_DFE vT2 5_EGFvT2(!KReact = require 'react/addons'5_FHG6vT2K6 child = React.addons.cloneWithProps(child,% width: imageWidth + "px")5_GIH vT2L' width: imageWidth + "px")5_HJI&vT2L& width: imageWidth + "px" )5_IJ vT2M N height: 5_ # #8v8T2! L widthHeightRatio: 3/5_! #8v8T2! L widthHeightRatio: 35_ "! #8v8T2! L widthHeightRatio: 5_!" #8v8T2" L widthHeightRatio: 15_#8v8T2t 5_  #8v8T0 G targetWidth: 200 5_ #8v8T0 F* targetWidth: 200 componentDidMount: ->5_ #8v8T0 E6 targetWidth: 200 componentDidMount: -> @onResize()5_ *#8v8T0 Dc targetWidth: 200 componentDidMount: -> @onResize() elementResizeEvent(@getDOMNode(), @onResize)5