ImageView.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. // wrapped by build app
  2. define("dojox/mobile/app/ImageView", ["dijit","dojo","dojox","dojo/require!dojox/mobile/app/_Widget,dojo/fx/easing"], function(dijit,dojo,dojox){
  3. dojo.provide("dojox.mobile.app.ImageView");
  4. dojo.experimental("dojox.mobile.app.ImageView");
  5. dojo.require("dojox.mobile.app._Widget");
  6. dojo.require("dojo.fx.easing");
  7. dojo.declare("dojox.mobile.app.ImageView", dojox.mobile.app._Widget, {
  8. // zoom: Number
  9. // The current level of zoom. This should not be set manually.
  10. zoom: 1,
  11. // zoomCenterX: Number
  12. // The X coordinate in the image where the zoom is focused
  13. zoomCenterX: 0,
  14. // zoomCenterY: Number
  15. // The Y coordinate in the image where the zoom is focused
  16. zoomCenterY: 0,
  17. // maxZoom: Number
  18. // The highest degree to which an image can be zoomed. For example,
  19. // a maxZoom of 5 means that the image will be 5 times larger than normal
  20. maxZoom: 5,
  21. // autoZoomLevel: Number
  22. // The degree to which the image is zoomed when auto zoom is invoked.
  23. // The higher the number, the more the image is zoomed in.
  24. autoZoomLevel: 3,
  25. // disableAutoZoom: Boolean
  26. // Disables auto zoom
  27. disableAutoZoom: false,
  28. // disableSwipe: Boolean
  29. // Disables the users ability to swipe from one image to the next.
  30. disableSwipe: false,
  31. // autoZoomEvent: String
  32. // Overrides the default event listened to which invokes auto zoom
  33. autoZoomEvent: null,
  34. // _leftImg: Node
  35. // The full sized image to the left
  36. _leftImg: null,
  37. // _centerImg: Node
  38. // The full sized image in the center
  39. _centerImg: null,
  40. // _rightImg: Node
  41. // The full sized image to the right
  42. _rightImg: null,
  43. // _leftImg: Node
  44. // The small sized image to the left
  45. _leftSmallImg: null,
  46. // _centerImg: Node
  47. // The small sized image in the center
  48. _centerSmallImg: null,
  49. // _rightImg: Node
  50. // The small sized image to the right
  51. _rightSmallImg: null,
  52. constructor: function(){
  53. this.panX = 0;
  54. this.panY = 0;
  55. this.handleLoad = dojo.hitch(this, this.handleLoad);
  56. this._updateAnimatedZoom = dojo.hitch(this, this._updateAnimatedZoom);
  57. this._updateAnimatedPan = dojo.hitch(this, this._updateAnimatedPan);
  58. this._onAnimPanEnd = dojo.hitch(this, this._onAnimPanEnd);
  59. },
  60. buildRendering: function(){
  61. this.inherited(arguments);
  62. this.canvas = dojo.create("canvas", {}, this.domNode);
  63. dojo.addClass(this.domNode, "mblImageView");
  64. },
  65. postCreate: function(){
  66. this.inherited(arguments);
  67. this.size = dojo.marginBox(this.domNode);
  68. dojo.style(this.canvas, {
  69. width: this.size.w + "px",
  70. height: this.size.h + "px"
  71. });
  72. this.canvas.height = this.size.h;
  73. this.canvas.width = this.size.w;
  74. var _this = this;
  75. // Listen to the mousedown/touchstart event. Record the position
  76. // so we can use it to pan the image.
  77. this.connect(this.domNode, "onmousedown", function(event){
  78. if(_this.isAnimating()){
  79. return;
  80. }
  81. if(_this.panX){
  82. _this.handleDragEnd();
  83. }
  84. _this.downX = event.targetTouches ? event.targetTouches[0].clientX : event.clientX;
  85. _this.downY = event.targetTouches ? event.targetTouches[0].clientY : event.clientY;
  86. });
  87. // record the movement of the mouse.
  88. this.connect(this.domNode, "onmousemove", function(event){
  89. if(_this.isAnimating()){
  90. return;
  91. }
  92. if((!_this.downX && _this.downX !== 0) || (!_this.downY && _this.downY !== 0)){
  93. // If the touch didn't begin on this widget, ignore the movement
  94. return;
  95. }
  96. if((!_this.disableSwipe && _this.zoom == 1)
  97. || (!_this.disableAutoZoom && _this.zoom != 1)){
  98. var x = event.targetTouches ?
  99. event.targetTouches[0].clientX : event.pageX;
  100. var y = event.targetTouches ?
  101. event.targetTouches[0].clientY : event.pageY;
  102. _this.panX = x - _this.downX;
  103. _this.panY = y - _this.downY;
  104. if(_this.zoom == 1){
  105. // If not zoomed in, then try to move to the next or prev image
  106. // but only if the mouse has moved more than 10 pixels
  107. // in the X direction
  108. if(Math.abs(_this.panX) > 10){
  109. _this.render();
  110. }
  111. }else{
  112. // If zoomed in, pan the image if the mouse has moved more
  113. // than 10 pixels in either direction.
  114. if(Math.abs(_this.panX) > 10 || Math.abs(_this.panY) > 10){
  115. _this.render();
  116. }
  117. }
  118. }
  119. });
  120. this.connect(this.domNode, "onmouseout", function(event){
  121. if(!_this.isAnimating() && _this.panX){
  122. _this.handleDragEnd();
  123. }
  124. });
  125. this.connect(this.domNode, "onmouseover", function(event){
  126. _this.downX = _this.downY = null;
  127. });
  128. // Set up AutoZoom, which zooms in a fixed amount when the user taps
  129. // a part of the canvas
  130. this.connect(this.domNode, "onclick", function(event){
  131. if(_this.isAnimating()){
  132. return;
  133. }
  134. if(_this.downX == null || _this.downY == null){
  135. return;
  136. }
  137. var x = (event.targetTouches ?
  138. event.targetTouches[0].clientX : event.pageX);
  139. var y = (event.targetTouches ?
  140. event.targetTouches[0].clientY : event.pageY);
  141. // If the mouse/finger has moved more than 14 pixels from where it
  142. // started, do not treat it as a click. It is a drag.
  143. if(Math.abs(_this.panX) > 14 || Math.abs(_this.panY) > 14){
  144. _this.downX = _this.downY = null;
  145. _this.handleDragEnd();
  146. return;
  147. }
  148. _this.downX = _this.downY = null;
  149. if(!_this.disableAutoZoom){
  150. if(!_this._centerImg || !_this._centerImg._loaded){
  151. // Do nothing until the image is loaded
  152. return;
  153. }
  154. if(_this.zoom != 1){
  155. _this.set("animatedZoom", 1);
  156. return;
  157. }
  158. var pos = dojo._abs(_this.domNode);
  159. // Translate the clicked point to a point on the source image
  160. var xRatio = _this.size.w / _this._centerImg.width;
  161. var yRatio = _this.size.h / _this._centerImg.height;
  162. // Do an animated zoom to the point which was clicked.
  163. _this.zoomTo(
  164. ((x - pos.x) / xRatio) - _this.panX,
  165. ((y - pos.y) / yRatio) - _this.panY,
  166. _this.autoZoomLevel);
  167. }
  168. });
  169. // Listen for Flick events
  170. dojo.connect(this.domNode, "flick", this, "handleFlick");
  171. },
  172. isAnimating: function(){
  173. // summary:
  174. // Returns true if an animation is in progress, false otherwise.
  175. return this._anim && this._anim.status() == "playing";
  176. },
  177. handleDragEnd: function(){
  178. // summary:
  179. // Handles the end of a dragging event. If not zoomed in, it
  180. // determines if the next or previous image should be transitioned
  181. // to.
  182. this.downX = this.downY = null;
  183. console.log("handleDragEnd");
  184. if(this.zoom == 1){
  185. if(!this.panX){
  186. return;
  187. }
  188. var leftLoaded = (this._leftImg && this._leftImg._loaded)
  189. || (this._leftSmallImg && this._leftSmallImg._loaded);
  190. var rightLoaded = (this._rightImg && this._rightImg._loaded)
  191. || (this._rightSmallImg && this._rightSmallImg._loaded);
  192. // Check if the drag has moved the image more than half its length.
  193. // If so, move to either the previous or next image.
  194. var doMove =
  195. !(Math.abs(this.panX) < this._centerImg._baseWidth / 2) &&
  196. (
  197. (this.panX > 0 && leftLoaded ? 1 : 0) ||
  198. (this.panX < 0 && rightLoaded ? 1 : 0)
  199. );
  200. if(!doMove){
  201. // If not moving to another image, animate the sliding of the
  202. // image back into place.
  203. this._animPanTo(0, dojo.fx.easing.expoOut, 700);
  204. }else{
  205. // Move to another image.
  206. this.moveTo(this.panX);
  207. }
  208. }else{
  209. if(!this.panX && !this.panY){
  210. return;
  211. }
  212. // Recenter the zoomed image based on where it was panned to
  213. // previously
  214. this.zoomCenterX -= (this.panX / this.zoom);
  215. this.zoomCenterY -= (this.panY / this.zoom);
  216. this.panX = this.panY = 0;
  217. }
  218. },
  219. handleFlick: function(event){
  220. // summary:
  221. // Handle a flick event.
  222. if(this.zoom == 1 && event.duration < 500){
  223. // Only handle quick flicks here, less than 0.5 seconds
  224. // If not zoomed in, then check if we should move to the next photo
  225. // or not
  226. if(event.direction == "ltr"){
  227. this.moveTo(1);
  228. }else if(event.direction == "rtl"){
  229. this.moveTo(-1);
  230. }
  231. // If an up or down flick occurs, it means nothing so ignore it
  232. this.downX = this.downY = null;
  233. }
  234. },
  235. moveTo: function(direction){
  236. direction = direction > 0 ? 1 : -1;
  237. var toImg;
  238. if(direction < 1){
  239. if(this._rightImg && this._rightImg._loaded){
  240. toImg = this._rightImg;
  241. }else if(this._rightSmallImg && this._rightSmallImg._loaded){
  242. toImg = this._rightSmallImg;
  243. }
  244. }else{
  245. if(this._leftImg && this._leftImg._loaded){
  246. toImg = this._leftImg;
  247. }else if(this._leftSmallImg && this._leftSmallImg._loaded){
  248. toImg = this._leftSmallImg;
  249. }
  250. }
  251. this._moveDir = direction;
  252. var _this = this;
  253. if(toImg && toImg._loaded){
  254. // If the image is loaded, make a linear animation to show it
  255. this._animPanTo(this.size.w * direction, null, 500, function(){
  256. _this.panX = 0;
  257. _this.panY = 0;
  258. if(direction < 0){
  259. // Moving to show the right image
  260. _this._switchImage("left", "right");
  261. }else{
  262. // Moving to show the left image
  263. _this._switchImage("right", "left");
  264. }
  265. _this.render();
  266. _this.onChange(direction * -1);
  267. });
  268. }else{
  269. // If the next image is not loaded, make an animation to
  270. // move the center image to half the width of the widget and back
  271. // again
  272. console.log("moveTo image not loaded!", toImg);
  273. this._animPanTo(0, dojo.fx.easing.expoOut, 700);
  274. }
  275. },
  276. _switchImage: function(toImg, fromImg){
  277. var toSmallImgName = "_" + toImg + "SmallImg";
  278. var toImgName = "_" + toImg + "Img";
  279. var fromSmallImgName = "_" + fromImg + "SmallImg";
  280. var fromImgName = "_" + fromImg + "Img";
  281. this[toImgName] = this._centerImg;
  282. this[toSmallImgName] = this._centerSmallImg;
  283. this[toImgName]._type = toImg;
  284. if(this[toSmallImgName]){
  285. this[toSmallImgName]._type = toImg;
  286. }
  287. this._centerImg = this[fromImgName];
  288. this._centerSmallImg = this[fromSmallImgName];
  289. this._centerImg._type = "center";
  290. if(this._centerSmallImg){
  291. this._centerSmallImg._type = "center";
  292. }
  293. this[fromImgName] = this[fromSmallImgName] = null;
  294. },
  295. _animPanTo: function(to, easing, duration, callback){
  296. this._animCallback = callback;
  297. this._anim = new dojo.Animation({
  298. curve: [this.panX, to],
  299. onAnimate: this._updateAnimatedPan,
  300. duration: duration || 500,
  301. easing: easing,
  302. onEnd: this._onAnimPanEnd
  303. });
  304. this._anim.play();
  305. return this._anim;
  306. },
  307. onChange: function(direction){
  308. // summary:
  309. // Stub function that can be listened to in order to provide
  310. // new images when the displayed image changes
  311. },
  312. _updateAnimatedPan: function(amount){
  313. this.panX = amount;
  314. this.render();
  315. },
  316. _onAnimPanEnd: function(){
  317. this.panX = this.panY = 0;
  318. if(this._animCallback){
  319. this._animCallback();
  320. }
  321. },
  322. zoomTo: function(centerX, centerY, zoom){
  323. this.set("zoomCenterX", centerX);
  324. this.set("zoomCenterY", centerY);
  325. this.set("animatedZoom", zoom);
  326. },
  327. render: function(){
  328. var cxt = this.canvas.getContext('2d');
  329. cxt.clearRect(0, 0, this.canvas.width, this.canvas.height);
  330. // Render the center image
  331. this._renderImg(
  332. this._centerSmallImg,
  333. this._centerImg,
  334. this.zoom == 1 ? (this.panX < 0 ? 1 : this.panX > 0 ? -1 : 0) : 0);
  335. if(this.zoom == 1 && this.panX != 0){
  336. if(this.panX > 0){
  337. // Render the left image, showing the right side of it
  338. this._renderImg(this._leftSmallImg, this._leftImg, 1);
  339. }else{
  340. // Render the right image, showing the left side of it
  341. this._renderImg(this._rightSmallImg, this._rightImg, -1);
  342. }
  343. }
  344. },
  345. _renderImg: function(smallImg, largeImg, panDir){
  346. // summary:
  347. // Renders a single image
  348. // If zoomed, we just display the center img
  349. var img = (largeImg && largeImg._loaded) ? largeImg : smallImg;
  350. if(!img || !img._loaded){
  351. // If neither the large or small image is loaded, display nothing
  352. return;
  353. }
  354. var cxt = this.canvas.getContext('2d');
  355. var baseWidth = img._baseWidth;
  356. var baseHeight = img._baseHeight;
  357. // Calculate the size the image would be if there were no bounds
  358. var desiredWidth = baseWidth * this.zoom;
  359. var desiredHeight = baseHeight * this.zoom;
  360. // Calculate the actual size of the viewable image
  361. var destWidth = Math.min(this.size.w, desiredWidth);
  362. var destHeight = Math.min(this.size.h, desiredHeight);
  363. // Calculate the size of the window on the original image to use
  364. var sourceWidth = this.dispWidth = img.width * (destWidth / desiredWidth);
  365. var sourceHeight = this.dispHeight = img.height * (destHeight / desiredHeight);
  366. var zoomCenterX = this.zoomCenterX - (this.panX / this.zoom);
  367. var zoomCenterY = this.zoomCenterY - (this.panY / this.zoom);
  368. // Calculate where the center of the view should be
  369. var centerX = Math.floor(Math.max(sourceWidth / 2,
  370. Math.min(img.width - sourceWidth / 2, zoomCenterX)));
  371. var centerY = Math.floor(Math.max(sourceHeight / 2,
  372. Math.min(img.height - sourceHeight / 2, zoomCenterY)));
  373. var sourceX = Math.max(0,
  374. Math.round((img.width - sourceWidth)/2 + (centerX - img._centerX)) );
  375. var sourceY = Math.max(0,
  376. Math.round((img.height - sourceHeight) / 2 + (centerY - img._centerY))
  377. );
  378. var destX = Math.round(Math.max(0, this.canvas.width - destWidth)/2);
  379. var destY = Math.round(Math.max(0, this.canvas.height - destHeight)/2);
  380. var oldDestWidth = destWidth;
  381. var oldSourceWidth = sourceWidth;
  382. if(this.zoom == 1 && panDir && this.panX){
  383. if(this.panX < 0){
  384. if(panDir > 0){
  385. // If the touch is moving left, and the right side of the
  386. // image should be shown, then reduce the destination width
  387. // by the absolute value of panX
  388. destWidth -= Math.abs(this.panX);
  389. destX = 0;
  390. }else if(panDir < 0){
  391. // If the touch is moving left, and the left side of the
  392. // image should be shown, then set the displayed width
  393. // to the absolute value of panX, less some pixels for
  394. // a padding between images
  395. destWidth = Math.max(1, Math.abs(this.panX) - 5);
  396. destX = this.size.w - destWidth;
  397. }
  398. }else{
  399. if(panDir > 0){
  400. // If the touch is moving right, and the right side of the
  401. // image should be shown, then set the destination width
  402. // to the absolute value of the pan, less some pixels for
  403. // padding
  404. destWidth = Math.max(1, Math.abs(this.panX) - 5);
  405. destX = 0;
  406. }else if(panDir < 0){
  407. // If the touch is moving right, and the left side of the
  408. // image should be shown, then reduce the destination width
  409. // by the widget width minus the absolute value of panX
  410. destWidth -= Math.abs(this.panX);
  411. destX = this.size.w - destWidth;
  412. }
  413. }
  414. sourceWidth = Math.max(1,
  415. Math.floor(sourceWidth * (destWidth / oldDestWidth)));
  416. if(panDir > 0){
  417. // If the right side of the image should be displayed, move
  418. // the sourceX to be the width of the image minus the difference
  419. // between the original sourceWidth and the new sourceWidth
  420. sourceX = (sourceX + oldSourceWidth) - (sourceWidth);
  421. }
  422. sourceX = Math.floor(sourceX);
  423. }
  424. try{
  425. // See https://developer.mozilla.org/en/Canvas_tutorial/Using_images
  426. cxt.drawImage(
  427. img,
  428. Math.max(0, sourceX),
  429. sourceY,
  430. Math.min(oldSourceWidth, sourceWidth),
  431. sourceHeight,
  432. destX, // Xpos
  433. destY, // Ypos
  434. Math.min(oldDestWidth, destWidth),
  435. destHeight
  436. );
  437. }catch(e){
  438. console.log("Caught Error",e,
  439. "type=", img._type,
  440. "oldDestWidth = ", oldDestWidth,
  441. "destWidth", destWidth,
  442. "destX", destX
  443. , "oldSourceWidth=",oldSourceWidth,
  444. "sourceWidth=", sourceWidth,
  445. "sourceX = " + sourceX
  446. );
  447. }
  448. },
  449. _setZoomAttr: function(amount){
  450. this.zoom = Math.min(this.maxZoom, Math.max(1, amount));
  451. if(this.zoom == 1
  452. && this._centerImg
  453. && this._centerImg._loaded){
  454. if(!this.isAnimating()){
  455. this.zoomCenterX = this._centerImg.width / 2;
  456. this.zoomCenterY = this._centerImg.height / 2;
  457. }
  458. this.panX = this.panY = 0;
  459. }
  460. this.render();
  461. },
  462. _setZoomCenterXAttr: function(value){
  463. if(value != this.zoomCenterX){
  464. if(this._centerImg && this._centerImg._loaded){
  465. value = Math.min(this._centerImg.width, value);
  466. }
  467. this.zoomCenterX = Math.max(0, Math.round(value));
  468. }
  469. },
  470. _setZoomCenterYAttr: function(value){
  471. if(value != this.zoomCenterY){
  472. if(this._centerImg && this._centerImg._loaded){
  473. value = Math.min(this._centerImg.height, value);
  474. }
  475. this.zoomCenterY = Math.max(0, Math.round(value));
  476. }
  477. },
  478. _setZoomCenterAttr: function(value){
  479. if(value.x != this.zoomCenterX || value.y != this.zoomCenterY){
  480. this.set("zoomCenterX", value.x);
  481. this.set("zoomCenterY", value.y);
  482. this.render();
  483. }
  484. },
  485. _setAnimatedZoomAttr: function(amount){
  486. if(this._anim && this._anim.status() == "playing"){
  487. return;
  488. }
  489. this._anim = new dojo.Animation({
  490. curve: [this.zoom, amount],
  491. onAnimate: this._updateAnimatedZoom,
  492. onEnd: this._onAnimEnd
  493. });
  494. this._anim.play();
  495. },
  496. _updateAnimatedZoom: function(amount){
  497. this._setZoomAttr(amount);
  498. },
  499. _setCenterUrlAttr: function(urlOrObj){
  500. this._setImage("center", urlOrObj);
  501. },
  502. _setLeftUrlAttr: function(urlOrObj){
  503. this._setImage("left", urlOrObj);
  504. },
  505. _setRightUrlAttr: function(urlOrObj){
  506. this._setImage("right", urlOrObj);
  507. },
  508. _setImage: function(name, urlOrObj){
  509. var smallUrl = null;
  510. var largeUrl = null;
  511. if(dojo.isString(urlOrObj)){
  512. // If the argument is a string, then just load the large url
  513. largeUrl = urlOrObj;
  514. }else{
  515. largeUrl = urlOrObj.large;
  516. smallUrl = urlOrObj.small;
  517. }
  518. if(this["_" + name + "Img"] && this["_" + name + "Img"]._src == largeUrl){
  519. // Identical URL, ignore it
  520. return;
  521. }
  522. // Just do the large image for now
  523. var largeImg = this["_" + name + "Img"] = new Image();
  524. largeImg._type = name;
  525. largeImg._loaded = false;
  526. largeImg._src = largeUrl;
  527. largeImg._conn = dojo.connect(largeImg, "onload", this.handleLoad);
  528. if(smallUrl){
  529. // If a url to a small version of the image has been provided,
  530. // load that image first.
  531. var smallImg = this["_" + name + "SmallImg"] = new Image();
  532. smallImg._type = name;
  533. smallImg._loaded = false;
  534. smallImg._conn = dojo.connect(smallImg, "onload", this.handleLoad);
  535. smallImg._isSmall = true;
  536. smallImg._src = smallUrl;
  537. smallImg.src = smallUrl;
  538. }
  539. // It's important that the large url's src is set after the small image
  540. // to ensure it's loaded second.
  541. largeImg.src = largeUrl;
  542. },
  543. handleLoad: function(evt){
  544. // summary:
  545. // Handles the loading of an image, both the large and small
  546. // versions. A render is triggered as a result of each image load.
  547. var img = evt.target;
  548. img._loaded = true;
  549. dojo.disconnect(img._conn);
  550. var type = img._type;
  551. switch(type){
  552. case "center":
  553. this.zoomCenterX = img.width / 2;
  554. this.zoomCenterY = img.height / 2;
  555. break;
  556. }
  557. var height = img.height;
  558. var width = img.width;
  559. if(width / this.size.w < height / this.size.h){
  560. // Fit the height to the height of the canvas
  561. img._baseHeight = this.canvas.height;
  562. img._baseWidth = width / (height / this.size.h);
  563. }else{
  564. // Fix the width to the width of the canvas
  565. img._baseWidth = this.canvas.width;
  566. img._baseHeight = height / (width / this.size.w);
  567. }
  568. img._centerX = width / 2;
  569. img._centerY = height / 2;
  570. this.render();
  571. this.onLoad(img._type, img._src, img._isSmall);
  572. },
  573. onLoad: function(type, url, isSmall){
  574. // summary:
  575. // Dummy function that is called whenever an image loads.
  576. // type: String
  577. // The position of the image that has loaded, either
  578. // "center", "left" or "right"
  579. // url: String
  580. // The src of the image
  581. // isSmall: Boolean
  582. // True if it is a small version of the image that has loaded,
  583. // false otherwise.
  584. }
  585. });
  586. });