method_draw 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +148 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/method_draw.js +9 -0
  6. data/app/assets/javascripts/method_draw/base64.js +95 -0
  7. data/app/assets/javascripts/method_draw_embed.js +76 -0
  8. data/app/assets/stylesheets/sketchily.css +6 -0
  9. data/app/helpers/method_draw_helper.rb +35 -0
  10. data/app/views/method_draw/_embed.html.erb +51 -0
  11. data/app/views/method_draw/_method_draw.html.erb +19 -0
  12. data/app/views/method_draw/_method_draw_tag.html.erb +14 -0
  13. data/lib/method_draw.rb +16 -0
  14. data/lib/method_draw/engine.rb +4 -0
  15. data/lib/method_draw/method_draw.rb +37 -0
  16. data/lib/method_draw/method_draw_tag.rb +20 -0
  17. data/lib/method_draw/version.rb +3 -0
  18. data/spec/app/helpers/method_draw_helper_spec.rb +8 -0
  19. data/spec/dummy/README.md +3 -0
  20. data/spec/dummy/Rakefile +7 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  24. data/spec/dummy/app/controllers/drawings_controller.rb +18 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/models/drawing.rb +2 -0
  27. data/spec/dummy/app/views/drawings/method_draw.html.erb +3 -0
  28. data/spec/dummy/app/views/drawings/method_draw_tag.html.erb +3 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +27 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +29 -0
  36. data/spec/dummy/config/environments/production.rb +80 -0
  37. data/spec/dummy/config/environments/test.rb +36 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +8 -0
  47. data/spec/dummy/db/development.sqlite3 +0 -0
  48. data/spec/dummy/db/migrate/0_create_drawings.rb +7 -0
  49. data/spec/dummy/db/schema.rb +20 -0
  50. data/spec/dummy/db/test.sqlite3 +0 -0
  51. data/spec/dummy/log/development.log +922 -0
  52. data/spec/dummy/log/test.log +181 -0
  53. data/spec/dummy/public/404.html +26 -0
  54. data/spec/dummy/public/422.html +26 -0
  55. data/spec/dummy/public/500.html +25 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/dummy/script/rails +6 -0
  58. data/spec/dummy/tmp/cache/assets/development/sprockets/01e63791dcd008779246d1eeeace9408 +0 -0
  59. data/spec/dummy/tmp/cache/assets/development/sprockets/061f36c32f08daef6eca93b74eaf74fd +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/1dbfe77fba798ba3dc24571c3b6d7eed +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/1fd7477d83ec1798c2bc740be42bd6b2 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/203471220004cb0cc667b886fb87dc46 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/213e12fc648032455ca0b118e987cca6 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/296bbe63b0505bc5be472fc1c8a1a5fd +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/3239b44c026d7c1646c17a10c72905bf +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/38c8fbf05056bbe66399b6923521dc20 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/3e30c8cfdf7deeda4607e4a8298f09a5 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/4bdd61ba53e8d9b7c19afea13c6e8985 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/52b0b11efea48f1fe5e46eeb4aa20193 +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/5ef314d6f1af1570631d60b7f9a96d6c +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/6215f00c593e1789ef865a545b17fc14 +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/624fdd5478edd235a86af4b6168d0f75 +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/6299190ac3952cf7eee042e60c9aee89 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/62a95a2d67ec78570de6d0b31436206a +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/65ed942dea29700b739c2292791eb65e +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/66eb709561f77a29885af4423a3eb193 +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/6f8f2c21bc49ae5ebad6e8a96cea4fe6 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/85dab60ed9ec9625b7ee22d4342fe26c +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/86358bce0bfd5de6ac8afb1bfa9d675b +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/8b835ce894c1218dea1e7c83a9109d2d +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/8e177cc7106653a1e053bb2444bb43a5 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/8f41435d82ae4df55ae7dfdc1e99b0bb +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/94be0a0bca76437d0766c265a9cdecda +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/9a093e6973aa150a0a4388167364593d +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/a280ac195f56a87267d2ec5d3e22ebcd +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/b13cddebc9106da6cfaf949ab3856d1f +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/b29ac216cb03ce2f30655a0d9bed77d4 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/c39d32e3ef6cc89f9c522212e65c49e1 +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/c9910a0652952be02900dc71594d4384 +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/cb14e22baac3ab2cc947628f283e117b +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/d1475c156face9f06092c9cf89905372 +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/d22aa5a4d864d00cced2437352fe8fe4 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/d46cc5e60d1b2a20d622cdf9bab35fad +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/d7f27a7f35278e87c69668a65683360a +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/e0080336bb31d78e9efab59b234e0d85 +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/e06104d99b055e792effca7bd66ad384 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/e095df19da361d5f53d90f6749a38ea6 +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/e5fb97d39fdd2e383e61115ef06079fd +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/e6d1ec9817258cfda7c68499a841a9d2 +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/edec019e8f1d7e758eb45524a913fd47 +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/f37cf330dccb15bee2a195f643f3ba29 +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/fc84011813992cacde5880c6b21701de +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/061f36c32f08daef6eca93b74eaf74fd +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/38c8fbf05056bbe66399b6923521dc20 +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/3e30c8cfdf7deeda4607e4a8298f09a5 +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/52b0b11efea48f1fe5e46eeb4aa20193 +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/5ef314d6f1af1570631d60b7f9a96d6c +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/6299190ac3952cf7eee042e60c9aee89 +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/62a95a2d67ec78570de6d0b31436206a +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/65ed942dea29700b739c2292791eb65e +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/85dab60ed9ec9625b7ee22d4342fe26c +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/a280ac195f56a87267d2ec5d3e22ebcd +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/cb14e22baac3ab2cc947628f283e117b +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/d1475c156face9f06092c9cf89905372 +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  126. data/spec/dummy/tmp/cache/assets/test/sprockets/e0080336bb31d78e9efab59b234e0d85 +0 -0
  127. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  128. data/spec/dummy/tmp/pids/server.pid +1 -0
  129. data/spec/features/method_draw_spec.rb +10 -0
  130. data/spec/features/method_draw_tag_spec.rb +11 -0
  131. data/spec/lib/method_draw/method_draw_spec.rb +27 -0
  132. data/spec/lib/method_draw/method_draw_tag_spec.rb +19 -0
  133. data/spec/lib/method_draw_spec.rb +11 -0
  134. data/spec/test_helper.rb +24 -0
  135. data/vendor/assets/javascripts/method-draw-js/browser-not-supported.html +27 -0
  136. data/vendor/assets/javascripts/method-draw-js/css/font-files/Anivers-webfont.eot +0 -0
  137. data/vendor/assets/javascripts/method-draw-js/css/font-files/Anivers-webfont.ttf +0 -0
  138. data/vendor/assets/javascripts/method-draw-js/css/font-files/Anivers-webfont.woff +0 -0
  139. data/vendor/assets/javascripts/method-draw-js/css/font-files/Arvo-Regular-webfont.svg +145 -0
  140. data/vendor/assets/javascripts/method-draw-js/css/font-files/Arvo-Regular-webfont.ttf +0 -0
  141. data/vendor/assets/javascripts/method-draw-js/css/font-files/Junction-webfont.eot +0 -0
  142. data/vendor/assets/javascripts/method-draw-js/css/font-files/Junction-webfont.svg +133 -0
  143. data/vendor/assets/javascripts/method-draw-js/css/font-files/Junction-webfont.ttf +0 -0
  144. data/vendor/assets/javascripts/method-draw-js/css/font-files/Junction-webfont.woff +0 -0
  145. data/vendor/assets/javascripts/method-draw-js/css/font-files/League_Gothic-webfont.eot +0 -0
  146. data/vendor/assets/javascripts/method-draw-js/css/font-files/League_Gothic-webfont.svg +235 -0
  147. data/vendor/assets/javascripts/method-draw-js/css/font-files/League_Gothic-webfont.ttf +0 -0
  148. data/vendor/assets/javascripts/method-draw-js/css/font-files/League_Gothic-webfont.woff +0 -0
  149. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab-webfont.eot +0 -0
  150. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab-webfont.ttf +0 -0
  151. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab-webfont.woff +0 -0
  152. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab_Italic-webfont.eot +0 -0
  153. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab_Italic-webfont.ttf +0 -0
  154. data/vendor/assets/javascripts/method-draw-js/css/font-files/Museo_Slab_Italic-webfont.woff +0 -0
  155. data/vendor/assets/javascripts/method-draw-js/css/font-files/arvo-bold-webfont.woff +0 -0
  156. data/vendor/assets/javascripts/method-draw-js/css/font-files/arvo-bolditalic-webfont.woff +0 -0
  157. data/vendor/assets/javascripts/method-draw-js/css/font-files/arvo-italic-webfont.woff +0 -0
  158. data/vendor/assets/javascripts/method-draw-js/css/font-files/arvo-regular-webfont.woff +0 -0
  159. data/vendor/assets/javascripts/method-draw-js/css/font-files/euphoriascript-regular-webfont.woff +0 -0
  160. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood-webfont.eot +0 -0
  161. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood-webfont.svg +939 -0
  162. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood-webfont.ttf +0 -0
  163. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood-webfont.woff +0 -0
  164. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood_italic-webfont.eot +0 -0
  165. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood_italic-webfont.svg +682 -0
  166. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood_italic-webfont.ttf +0 -0
  167. data/vendor/assets/javascripts/method-draw-js/css/font-files/fanwood_italic-webfont.woff +0 -0
  168. data/vendor/assets/javascripts/method-draw-js/css/font-files/fertigo-webfont.eot +0 -0
  169. data/vendor/assets/javascripts/method-draw-js/css/font-files/fertigo-webfont.ttf +0 -0
  170. data/vendor/assets/javascripts/method-draw-js/css/font-files/fertigo-webfont.woff +0 -0
  171. data/vendor/assets/javascripts/method-draw-js/css/font-files/oswald-bold-webfont.woff +0 -0
  172. data/vendor/assets/javascripts/method-draw-js/css/font-files/oswald-light-webfont.woff +0 -0
  173. data/vendor/assets/javascripts/method-draw-js/css/font-files/shadowsintolight-webfont.woff +0 -0
  174. data/vendor/assets/javascripts/method-draw-js/css/font-files/simonetta-black-webfont.woff +0 -0
  175. data/vendor/assets/javascripts/method-draw-js/css/font-files/simonetta-blackitalic-webfont.woff +0 -0
  176. data/vendor/assets/javascripts/method-draw-js/css/font-files/simonetta-italic-webfont.ttf +0 -0
  177. data/vendor/assets/javascripts/method-draw-js/css/font-files/simonetta-regular-webfont.woff +0 -0
  178. data/vendor/assets/javascripts/method-draw-js/css/font-files/test.html +62 -0
  179. data/vendor/assets/javascripts/method-draw-js/css/font-files/test.svg +15 -0
  180. data/vendor/assets/javascripts/method-draw-js/css/font-files/test_ff.svg +16 -0
  181. data/vendor/assets/javascripts/method-draw-js/css/font-files/test_ffsvg.svg +13 -0
  182. data/vendor/assets/javascripts/method-draw-js/css/fonts.css +72 -0
  183. data/vendor/assets/javascripts/method-draw-js/css/method-draw.compiled.css +417 -0
  184. data/vendor/assets/javascripts/method-draw-js/css/method-draw.css +2083 -0
  185. data/vendor/assets/javascripts/method-draw-js/embedapi.html +56 -0
  186. data/vendor/assets/javascripts/method-draw-js/extensions/closepath_icons.svg +41 -0
  187. data/vendor/assets/javascripts/method-draw-js/extensions/ext-arrows.js +298 -0
  188. data/vendor/assets/javascripts/method-draw-js/extensions/ext-closepath.js +92 -0
  189. data/vendor/assets/javascripts/method-draw-js/extensions/ext-connector.js +587 -0
  190. data/vendor/assets/javascripts/method-draw-js/extensions/ext-eyedropper.js +135 -0
  191. data/vendor/assets/javascripts/method-draw-js/extensions/ext-foreignobject.js +277 -0
  192. data/vendor/assets/javascripts/method-draw-js/extensions/ext-grid.js +186 -0
  193. data/vendor/assets/javascripts/method-draw-js/extensions/ext-helloworld.js +78 -0
  194. data/vendor/assets/javascripts/method-draw-js/extensions/ext-imagelib.js +444 -0
  195. data/vendor/assets/javascripts/method-draw-js/extensions/ext-imagelib.xml +14 -0
  196. data/vendor/assets/javascripts/method-draw-js/extensions/ext-markers.js +576 -0
  197. data/vendor/assets/javascripts/method-draw-js/extensions/ext-server_moinsave.js +56 -0
  198. data/vendor/assets/javascripts/method-draw-js/extensions/ext-server_opensave.js +180 -0
  199. data/vendor/assets/javascripts/method-draw-js/extensions/ext-shapes.js +358 -0
  200. data/vendor/assets/javascripts/method-draw-js/extensions/ext-shapes.png +0 -0
  201. data/vendor/assets/javascripts/method-draw-js/extensions/ext-shapes.xml +8 -0
  202. data/vendor/assets/javascripts/method-draw-js/extensions/eyedropper-icon.xml +17 -0
  203. data/vendor/assets/javascripts/method-draw-js/extensions/eyedropper.png +0 -0
  204. data/vendor/assets/javascripts/method-draw-js/extensions/eyedropper.svg +15 -0
  205. data/vendor/assets/javascripts/method-draw-js/extensions/fileopen.php +31 -0
  206. data/vendor/assets/javascripts/method-draw-js/extensions/filesave.php +44 -0
  207. data/vendor/assets/javascripts/method-draw-js/extensions/foreignobject-icons.xml +96 -0
  208. data/vendor/assets/javascripts/method-draw-js/extensions/grid-icon.xml +30 -0
  209. data/vendor/assets/javascripts/method-draw-js/extensions/helloworld-icon.xml +21 -0
  210. data/vendor/assets/javascripts/method-draw-js/extensions/imagelib/index.html +64 -0
  211. data/vendor/assets/javascripts/method-draw-js/extensions/imagelib/smiley.svg +12 -0
  212. data/vendor/assets/javascripts/method-draw-js/extensions/markers-icons.xml +115 -0
  213. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib.png +0 -0
  214. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib.svg +10 -0
  215. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/arrow.json +40 -0
  216. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/dialog_balloon.json +14 -0
  217. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/flowchart.json +20 -0
  218. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/game.json +13 -0
  219. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/math.json +8 -0
  220. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/misc.json +6 -0
  221. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/music.json +21 -0
  222. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/nature.json +36 -0
  223. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/object.json +30 -0
  224. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/raphael.txt +12 -0
  225. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/raphael_1.json +7 -0
  226. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/social.json +21 -0
  227. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/symbol.json +35 -0
  228. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/ui.json +57 -0
  229. data/vendor/assets/javascripts/method-draw-js/extensions/shapelib/weather.json +26 -0
  230. data/vendor/assets/javascripts/method-draw-js/icons/jquery.svgicons.js +471 -0
  231. data/vendor/assets/javascripts/method-draw-js/images/AlphaBar.png +0 -0
  232. data/vendor/assets/javascripts/method-draw-js/images/Bars.png +0 -0
  233. data/vendor/assets/javascripts/method-draw-js/images/Maps.png +0 -0
  234. data/vendor/assets/javascripts/method-draw-js/images/NoColor.png +0 -0
  235. data/vendor/assets/javascripts/method-draw-js/images/README.txt +61 -0
  236. data/vendor/assets/javascripts/method-draw-js/images/align-bottom.png +0 -0
  237. data/vendor/assets/javascripts/method-draw-js/images/align-bottom.svg +1 -0
  238. data/vendor/assets/javascripts/method-draw-js/images/align-center.png +0 -0
  239. data/vendor/assets/javascripts/method-draw-js/images/align-center.svg +1 -0
  240. data/vendor/assets/javascripts/method-draw-js/images/align-left.png +0 -0
  241. data/vendor/assets/javascripts/method-draw-js/images/align-left.svg +1 -0
  242. data/vendor/assets/javascripts/method-draw-js/images/align-middle.png +0 -0
  243. data/vendor/assets/javascripts/method-draw-js/images/align-middle.svg +1 -0
  244. data/vendor/assets/javascripts/method-draw-js/images/align-right.png +0 -0
  245. data/vendor/assets/javascripts/method-draw-js/images/align-right.svg +1 -0
  246. data/vendor/assets/javascripts/method-draw-js/images/align-top.png +0 -0
  247. data/vendor/assets/javascripts/method-draw-js/images/align-top.svg +1 -0
  248. data/vendor/assets/javascripts/method-draw-js/images/bar-opacity.png +0 -0
  249. data/vendor/assets/javascripts/method-draw-js/images/bold.png +0 -0
  250. data/vendor/assets/javascripts/method-draw-js/images/cancel.png +0 -0
  251. data/vendor/assets/javascripts/method-draw-js/images/circle.png +0 -0
  252. data/vendor/assets/javascripts/method-draw-js/images/clear.png +0 -0
  253. data/vendor/assets/javascripts/method-draw-js/images/clone.png +0 -0
  254. data/vendor/assets/javascripts/method-draw-js/images/conn.svg +29 -0
  255. data/vendor/assets/javascripts/method-draw-js/images/copy.png +0 -0
  256. data/vendor/assets/javascripts/method-draw-js/images/cross.png +0 -0
  257. data/vendor/assets/javascripts/method-draw-js/images/cut.png +0 -0
  258. data/vendor/assets/javascripts/method-draw-js/images/delete.png +0 -0
  259. data/vendor/assets/javascripts/method-draw-js/images/document-properties.png +0 -0
  260. data/vendor/assets/javascripts/method-draw-js/images/drag.png +0 -0
  261. data/vendor/assets/javascripts/method-draw-js/images/dragging.png +0 -0
  262. data/vendor/assets/javascripts/method-draw-js/images/dropdown.gif +0 -0
  263. data/vendor/assets/javascripts/method-draw-js/images/ellipse.png +0 -0
  264. data/vendor/assets/javascripts/method-draw-js/images/ellipse.svg +8 -0
  265. data/vendor/assets/javascripts/method-draw-js/images/eye.png +0 -0
  266. data/vendor/assets/javascripts/method-draw-js/images/eye.svg +1 -0
  267. data/vendor/assets/javascripts/method-draw-js/images/eyedropper.png +0 -0
  268. data/vendor/assets/javascripts/method-draw-js/images/eyedropper_tool.png +0 -0
  269. data/vendor/assets/javascripts/method-draw-js/images/fhpath.png +0 -0
  270. data/vendor/assets/javascripts/method-draw-js/images/flyouth.png +0 -0
  271. data/vendor/assets/javascripts/method-draw-js/images/flyup.gif +0 -0
  272. data/vendor/assets/javascripts/method-draw-js/images/freehand-circle.png +0 -0
  273. data/vendor/assets/javascripts/method-draw-js/images/freehand-square.png +0 -0
  274. data/vendor/assets/javascripts/method-draw-js/images/go-down.png +0 -0
  275. data/vendor/assets/javascripts/method-draw-js/images/go-up.png +0 -0
  276. data/vendor/assets/javascripts/method-draw-js/images/image.png +0 -0
  277. data/vendor/assets/javascripts/method-draw-js/images/image.svg +12 -0
  278. data/vendor/assets/javascripts/method-draw-js/images/italic.png +0 -0
  279. data/vendor/assets/javascripts/method-draw-js/images/italic.svg +1 -0
  280. data/vendor/assets/javascripts/method-draw-js/images/line.png +0 -0
  281. data/vendor/assets/javascripts/method-draw-js/images/link_controls.png +0 -0
  282. data/vendor/assets/javascripts/method-draw-js/images/logo.png +0 -0
  283. data/vendor/assets/javascripts/method-draw-js/images/map-opacity.png +0 -0
  284. data/vendor/assets/javascripts/method-draw-js/images/mappoint.gif +0 -0
  285. data/vendor/assets/javascripts/method-draw-js/images/mappoint_c.png +0 -0
  286. data/vendor/assets/javascripts/method-draw-js/images/mappoint_f.png +0 -0
  287. data/vendor/assets/javascripts/method-draw-js/images/move_bottom.png +0 -0
  288. data/vendor/assets/javascripts/method-draw-js/images/move_top.png +0 -0
  289. data/vendor/assets/javascripts/method-draw-js/images/node_clone.png +0 -0
  290. data/vendor/assets/javascripts/method-draw-js/images/node_delete.png +0 -0
  291. data/vendor/assets/javascripts/method-draw-js/images/none.png +0 -0
  292. data/vendor/assets/javascripts/method-draw-js/images/open.png +0 -0
  293. data/vendor/assets/javascripts/method-draw-js/images/paste.png +0 -0
  294. data/vendor/assets/javascripts/method-draw-js/images/path.png +0 -0
  295. data/vendor/assets/javascripts/method-draw-js/images/path.svg +10 -0
  296. data/vendor/assets/javascripts/method-draw-js/images/pencil.png +0 -0
  297. data/vendor/assets/javascripts/method-draw-js/images/pencil.svg +11 -0
  298. data/vendor/assets/javascripts/method-draw-js/images/pencil_cursor.png +0 -0
  299. data/vendor/assets/javascripts/method-draw-js/images/picker.gif +0 -0
  300. data/vendor/assets/javascripts/method-draw-js/images/placeholder.svg +10 -0
  301. data/vendor/assets/javascripts/method-draw-js/images/polygon.png +0 -0
  302. data/vendor/assets/javascripts/method-draw-js/images/polygon.svg +1 -0
  303. data/vendor/assets/javascripts/method-draw-js/images/preview-opacity.png +0 -0
  304. data/vendor/assets/javascripts/method-draw-js/images/rangearrows.gif +0 -0
  305. data/vendor/assets/javascripts/method-draw-js/images/rangearrows2.gif +0 -0
  306. data/vendor/assets/javascripts/method-draw-js/images/rect.png +0 -0
  307. data/vendor/assets/javascripts/method-draw-js/images/redo.png +0 -0
  308. data/vendor/assets/javascripts/method-draw-js/images/reorient.png +0 -0
  309. data/vendor/assets/javascripts/method-draw-js/images/rotate.png +0 -0
  310. data/vendor/assets/javascripts/method-draw-js/images/save.png +0 -0
  311. data/vendor/assets/javascripts/method-draw-js/images/select.png +0 -0
  312. data/vendor/assets/javascripts/method-draw-js/images/select.svg +10 -0
  313. data/vendor/assets/javascripts/method-draw-js/images/select_node.png +0 -0
  314. data/vendor/assets/javascripts/method-draw-js/images/sep.png +0 -0
  315. data/vendor/assets/javascripts/method-draw-js/images/shape_group.png +0 -0
  316. data/vendor/assets/javascripts/method-draw-js/images/shape_ungroup.png +0 -0
  317. data/vendor/assets/javascripts/method-draw-js/images/source.png +0 -0
  318. data/vendor/assets/javascripts/method-draw-js/images/spinbtn_updn_big.png +0 -0
  319. data/vendor/assets/javascripts/method-draw-js/images/square.png +0 -0
  320. data/vendor/assets/javascripts/method-draw-js/images/svg_edit_icons.svg +455 -0
  321. data/vendor/assets/javascripts/method-draw-js/images/svg_edit_icons.svgz +0 -0
  322. data/vendor/assets/javascripts/method-draw-js/images/text.png +0 -0
  323. data/vendor/assets/javascripts/method-draw-js/images/text.svg +10 -0
  324. data/vendor/assets/javascripts/method-draw-js/images/to_path.png +0 -0
  325. data/vendor/assets/javascripts/method-draw-js/images/undo.png +0 -0
  326. data/vendor/assets/javascripts/method-draw-js/images/view-refresh.png +0 -0
  327. data/vendor/assets/javascripts/method-draw-js/images/wave.png +0 -0
  328. data/vendor/assets/javascripts/method-draw-js/images/wireframe.png +0 -0
  329. data/vendor/assets/javascripts/method-draw-js/images/zoom.png +0 -0
  330. data/vendor/assets/javascripts/method-draw-js/images/zoom.svg +12 -0
  331. data/vendor/assets/javascripts/method-draw-js/index.html +631 -0
  332. data/vendor/assets/javascripts/method-draw-js/lib/canvg/canvg.js +2620 -0
  333. data/vendor/assets/javascripts/method-draw-js/lib/canvg/rgbcolor.js +287 -0
  334. data/vendor/assets/javascripts/method-draw-js/lib/contextmenu.js +68 -0
  335. data/vendor/assets/javascripts/method-draw-js/lib/contextmenu/jquery.contextMenu.js +223 -0
  336. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/LICENSE +202 -0
  337. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/README +3 -0
  338. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/css/jPicker.css +250 -0
  339. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/css/jgraduate.css +332 -0
  340. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/AlphaBar.png +0 -0
  341. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/Bars.png +0 -0
  342. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/Maps.png +0 -0
  343. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/NoColor.png +0 -0
  344. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/bar-opacity.png +0 -0
  345. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/eyedropper.png +0 -0
  346. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/map-opacity.png +0 -0
  347. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/mappoint.gif +0 -0
  348. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/mappoint_c.png +0 -0
  349. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/mappoint_f.png +0 -0
  350. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/picker.gif +0 -0
  351. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/preview-opacity.png +0 -0
  352. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/rangearrows.gif +0 -0
  353. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/images/rangearrows2.gif +0 -0
  354. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/jpicker.min.js +2087 -0
  355. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/jquery.jgraduate.js +1175 -0
  356. data/vendor/assets/javascripts/method-draw-js/lib/jgraduate/jquery.jgraduate.min.js +37 -0
  357. data/vendor/assets/javascripts/method-draw-js/lib/jquery-draginput.js +181 -0
  358. data/vendor/assets/javascripts/method-draw-js/lib/jquery-ui/jquery-ui-1.8.17.custom.min.js +54 -0
  359. data/vendor/assets/javascripts/method-draw-js/lib/jquery-ui/jquery-ui-1.8.custom.min.js +84 -0
  360. data/vendor/assets/javascripts/method-draw-js/lib/jquery.js +2 -0
  361. data/vendor/assets/javascripts/method-draw-js/lib/jquerybbq/jquery.bbq.min.js +18 -0
  362. data/vendor/assets/javascripts/method-draw-js/lib/js-hotkeys/README.md +45 -0
  363. data/vendor/assets/javascripts/method-draw-js/lib/js-hotkeys/jquery.hotkeys.min.js +15 -0
  364. data/vendor/assets/javascripts/method-draw-js/lib/mousewheel.js +84 -0
  365. data/vendor/assets/javascripts/method-draw-js/lib/requestanimationframe.js +24 -0
  366. data/vendor/assets/javascripts/method-draw-js/lib/taphold.js +136 -0
  367. data/vendor/assets/javascripts/method-draw-js/lib/touch.js +28 -0
  368. data/vendor/assets/javascripts/method-draw-js/method-draw.compiled.css +417 -0
  369. data/vendor/assets/javascripts/method-draw-js/method-draw.compiled.js +692 -0
  370. data/vendor/assets/javascripts/method-draw-js/method-draw.manifest +121 -0
  371. data/vendor/assets/javascripts/method-draw-js/src/browser.js +181 -0
  372. data/vendor/assets/javascripts/method-draw-js/src/dialog.js +49 -0
  373. data/vendor/assets/javascripts/method-draw-js/src/dragupload.js +11 -0
  374. data/vendor/assets/javascripts/method-draw-js/src/draw.js +533 -0
  375. data/vendor/assets/javascripts/method-draw-js/src/embedapi.js +173 -0
  376. data/vendor/assets/javascripts/method-draw-js/src/history.js +601 -0
  377. data/vendor/assets/javascripts/method-draw-js/src/math.js +247 -0
  378. data/vendor/assets/javascripts/method-draw-js/src/method-draw.js +4140 -0
  379. data/vendor/assets/javascripts/method-draw-js/src/path.js +979 -0
  380. data/vendor/assets/javascripts/method-draw-js/src/sanitize.js +273 -0
  381. data/vendor/assets/javascripts/method-draw-js/src/select.js +608 -0
  382. data/vendor/assets/javascripts/method-draw-js/src/svgcanvas.js +9047 -0
  383. data/vendor/assets/javascripts/method-draw-js/src/svgtransformlist.js +291 -0
  384. data/vendor/assets/javascripts/method-draw-js/src/svgutils.js +648 -0
  385. data/vendor/assets/javascripts/method-draw-js/src/units.js +281 -0
  386. data/vendor/assets/javascripts/method-draw-js/svgedit.compiled.css +417 -0
  387. data/vendor/assets/javascripts/method-draw-js/svgedit.compiled.js +691 -0
  388. data/vendor/assets/javascripts/method-draw-js/temp.css +2665 -0
  389. metadata +619 -0
@@ -0,0 +1,173 @@
1
+ /*
2
+ function embedded_svg_edit(frame){
3
+ //initialize communication
4
+ this.frame = frame;
5
+ this.stack = []; //callback stack
6
+
7
+ var editapi = this;
8
+
9
+ window.addEventListener("message", function(e){
10
+ if(e.data.substr(0,5) == "ERROR"){
11
+ editapi.stack.splice(0,1)[0](e.data,"error")
12
+ }else{
13
+ editapi.stack.splice(0,1)[0](e.data)
14
+ }
15
+ }, false)
16
+ }
17
+
18
+ embedded_svg_edit.prototype.call = function(code, callback){
19
+ this.stack.push(callback);
20
+ this.frame.contentWindow.postMessage(code,"*");
21
+ }
22
+
23
+ embedded_svg_edit.prototype.getSvgString = function(callback){
24
+ this.call("svgCanvas.getSvgString()",callback)
25
+ }
26
+
27
+ embedded_svg_edit.prototype.setSvgString = function(svg){
28
+ this.call("svgCanvas.setSvgString('"+svg.replace(/'/g, "\\'")+"')");
29
+ }
30
+ */
31
+
32
+
33
+ /*
34
+ Embedded SVG-edit API
35
+
36
+ General usage:
37
+ - Have an iframe somewhere pointing to a version of svg-edit > r1000
38
+ - Initialize the magic with:
39
+ var svgCanvas = new embedded_svg_edit(window.frames['svgedit']);
40
+ - Pass functions in this format:
41
+ svgCanvas.setSvgString("string")
42
+ - Or if a callback is needed:
43
+ svgCanvas.setSvgString("string")(function(data, error){
44
+ if(error){
45
+ //there was an error
46
+ }else{
47
+ //handle data
48
+ }
49
+ })
50
+
51
+ Everything is done with the same API as the real svg-edit,
52
+ and all documentation is unchanged. The only difference is
53
+ when handling returns, the callback notation is used instead.
54
+
55
+ var blah = new embedded_svg_edit(window.frames['svgedit']);
56
+ blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)})
57
+ */
58
+
59
+ function embedded_svg_edit(frame){
60
+ //initialize communication
61
+ this.frame = frame;
62
+ //this.stack = [] //callback stack
63
+ this.callbacks = {}; //successor to stack
64
+ this.encode = embedded_svg_edit.encode;
65
+ //List of functions extracted with this:
66
+ //Run in firebug on http://svg-edit.googlecode.com/svn/trunk/docs/files/svgcanvas-js.html
67
+
68
+ //for(var i=0,q=[],f = document.querySelectorAll("div.CFunction h3.CTitle a");i<f.length;i++){q.push(f[i].name)};q
69
+ //var functions = ["clearSelection", "addToSelection", "removeFromSelection", "open", "save", "getSvgString", "setSvgString",
70
+ //"createLayer", "deleteCurrentLayer", "setCurrentLayer", "renameCurrentLayer", "setCurrentLayerPosition", "setLayerVisibility",
71
+ //"moveSelectedToLayer", "clear"];
72
+
73
+
74
+ //Newer, well, it extracts things that aren't documented as well. All functions accessible through the normal thingy can now be accessed though the API
75
+ //var l=[];for(var i in svgCanvas){if(typeof svgCanvas[i] == "function"){l.push(i)}};
76
+ //run in svgedit itself
77
+ var functions = ["updateElementFromJson", "embedImage", "fixOperaXML", "clearSelection", "addToSelection",
78
+ "removeFromSelection", "addNodeToSelection", "open", "save", "getSvgString", "setSvgString", "createLayer",
79
+ "deleteCurrentLayer", "getCurrentDrawing", "setCurrentLayer", "renameCurrentLayer", "setCurrentLayerPosition",
80
+ "setLayerVisibility", "moveSelectedToLayer", "clear", "clearPath", "getNodePoint", "clonePathNode", "deletePathNode",
81
+ "getResolution", "getImageTitle", "setImageTitle", "setResolution", "setBBoxZoom", "setZoom", "getMode", "setMode",
82
+ "getStrokeColor", "setStrokeColor", "getFillColor", "setFillColor", "setStrokePaint", "setFillPaint", "getStrokeWidth",
83
+ "setStrokeWidth", "getStrokeStyle", "setStrokeStyle", "getOpacity", "setOpacity", "getFillOpacity", "setFillOpacity",
84
+ "getStrokeOpacity", "setStrokeOpacity", "getTransformList", "getBBox", "getRotationAngle", "setRotationAngle", "each",
85
+ "bind", "setIdPrefix", "getBold", "setBold", "getItalic", "setItalic", "getFontFamily", "setFontFamily", "getFontSize",
86
+ "setFontSize", "getText", "setTextContent", "setImageURL", "setRectRadius", "setSegType", "quickClone",
87
+ "changeSelectedAttributeNoUndo", "changeSelectedAttribute", "deleteSelectedElements", "groupSelectedElements",
88
+ "ungroupSelectedElement", "moveToTopSelectedElement", "moveToBottomSelectedElement", "moveSelectedElements",
89
+ "getStrokedBBox", "getVisibleElements", "cycleElement", "getUndoStackSize", "getRedoStackSize", "getNextUndoCommandText",
90
+ "getNextRedoCommandText", "undo", "redo", "cloneSelectedElements", "alignSelectedElements", "getZoom", "getVersion",
91
+ "setIconSize", "setLang", "setCustomHandlers"];
92
+
93
+ //TODO: rewrite the following, it's pretty scary.
94
+ for(var i = 0; i < functions.length; i++){
95
+ this[functions[i]] = (function(d){
96
+ return function(){
97
+ var t = this //new callback
98
+ for(var g = 0, args = []; g < arguments.length; g++){
99
+ args.push(arguments[g]);
100
+ }
101
+ var cbid = t.send(d,args, function(){}) //the callback (currently it's nothing, but will be set later
102
+
103
+ return function(newcallback){
104
+ t.callbacks[cbid] = newcallback; //set callback
105
+ }
106
+ }
107
+ })(functions[i])
108
+ }
109
+ //TODO: use AddEvent for Trident browsers, currently they dont support SVG, but they do support onmessage
110
+ var t = this;
111
+ window.addEventListener("message", function(e){
112
+ if(e.data.substr(0,4)=="SVGe"){ //because svg-edit is too longish
113
+ var data = e.data.substr(4);
114
+ var cbid = data.substr(0, data.indexOf(";"));
115
+ if(t.callbacks[cbid]){
116
+ if(data.substr(0,6) != "error:"){
117
+ t.callbacks[cbid](eval("("+data.substr(cbid.length+1)+")"))
118
+ }else{
119
+ t.callbacks[cbid](data, "error");
120
+ }
121
+ }
122
+ }
123
+ //this.stack.shift()[0](e.data,e.data.substr(0,5) == "ERROR"?'error':null) //replace with shift
124
+ }, false)
125
+ }
126
+
127
+ embedded_svg_edit.encode = function(obj){
128
+ //simple partial JSON encoder implementation
129
+ if(window.JSON && JSON.stringify) return JSON.stringify(obj);
130
+ var enc = arguments.callee; //for purposes of recursion
131
+
132
+ if(typeof obj == "boolean" || typeof obj == "number"){
133
+ return obj+'' //should work...
134
+ }else if(typeof obj == "string"){
135
+ //a large portion of this is stolen from Douglas Crockford's json2.js
136
+ return '"'+
137
+ obj.replace(
138
+ /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g
139
+ , function (a) {
140
+ return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
141
+ })
142
+ +'"'; //note that this isn't quite as purtyful as the usualness
143
+ }else if(obj.length){ //simple hackish test for arrayish-ness
144
+ for(var i = 0; i < obj.length; i++){
145
+ obj[i] = enc(obj[i]); //encode every sub-thingy on top
146
+ }
147
+ return "["+obj.join(",")+"]";
148
+ }else{
149
+ var pairs = []; //pairs will be stored here
150
+ for(var k in obj){ //loop through thingys
151
+ pairs.push(enc(k)+":"+enc(obj[k])); //key: value
152
+ }
153
+ return "{"+pairs.join(",")+"}" //wrap in the braces
154
+ }
155
+ }
156
+
157
+ embedded_svg_edit.prototype.send = function(name, args, callback){
158
+ var cbid = Math.floor(Math.random()*31776352877+993577).toString();
159
+ //this.stack.push(callback);
160
+ this.callbacks[cbid] = callback;
161
+ for(var argstr = [], i = 0; i < args.length; i++){
162
+ argstr.push(this.encode(args[i]))
163
+ }
164
+ var t = this;
165
+ setTimeout(function(){//delay for the callback to be set in case its synchronous
166
+ t.frame.contentWindow.postMessage(cbid+";svgCanvas['"+name+"']("+argstr.join(",")+")","*");
167
+ }, 0);
168
+ return cbid;
169
+ //this.stack.shift()("svgCanvas['"+name+"']("+argstr.join(",")+")")
170
+ }
171
+
172
+
173
+
@@ -0,0 +1,601 @@
1
+ /**
2
+ * Package: svedit.history
3
+ *
4
+ * Licensed under the Apache License, Version 2
5
+ *
6
+ * Copyright(c) 2010 Jeff Schiller
7
+ */
8
+
9
+ // Dependencies:
10
+ // 1) jQuery
11
+ // 2) svgtransformlist.js
12
+ // 3) svgutils.js
13
+
14
+ var svgedit = svgedit || {};
15
+
16
+ (function() {
17
+
18
+ if (!svgedit.history) {
19
+ svgedit.history = {};
20
+ }
21
+
22
+ // Group: Undo/Redo history management
23
+
24
+
25
+ svgedit.history.HistoryEventTypes = {
26
+ BEFORE_APPLY: 'before_apply',
27
+ AFTER_APPLY: 'after_apply',
28
+ BEFORE_UNAPPLY: 'before_unapply',
29
+ AFTER_UNAPPLY: 'after_unapply'
30
+ };
31
+
32
+ var removedElements = {};
33
+
34
+ /**
35
+ * Interface: svgedit.history.HistoryCommand
36
+ * An interface that all command objects must implement.
37
+ *
38
+ * interface svgedit.history.HistoryCommand {
39
+ * void apply(svgedit.history.HistoryEventHandler);
40
+ * void unapply(svgedit.history.HistoryEventHandler);
41
+ * Element[] elements();
42
+ * String getText();
43
+ *
44
+ * static String type();
45
+ * }
46
+ *
47
+ * Interface: svgedit.history.HistoryEventHandler
48
+ * An interface for objects that will handle history events.
49
+ *
50
+ * interface svgedit.history.HistoryEventHandler {
51
+ * void handleHistoryEvent(eventType, command);
52
+ * }
53
+ *
54
+ * eventType is a string conforming to one of the HistoryEvent types.
55
+ * command is an object fulfilling the HistoryCommand interface.
56
+ */
57
+
58
+ // Class: svgedit.history.MoveElementCommand
59
+ // implements svgedit.history.HistoryCommand
60
+ // History command for an element that had its DOM position changed
61
+ //
62
+ // Parameters:
63
+ // elem - The DOM element that was moved
64
+ // oldNextSibling - The element's next sibling before it was moved
65
+ // oldParent - The element's parent before it was moved
66
+ // text - An optional string visible to user related to this change
67
+ svgedit.history.MoveElementCommand = function(elem, oldNextSibling, oldParent, text) {
68
+ this.elem = elem;
69
+ this.text = text ? ("Move " + elem.tagName + " to " + text) : ("Move " + elem.tagName);
70
+ this.oldNextSibling = oldNextSibling;
71
+ this.oldParent = oldParent;
72
+ this.newNextSibling = elem.nextSibling;
73
+ this.newParent = elem.parentNode;
74
+ };
75
+ svgedit.history.MoveElementCommand.type = function() { return 'svgedit.history.MoveElementCommand'; }
76
+ svgedit.history.MoveElementCommand.prototype.type = svgedit.history.MoveElementCommand.type;
77
+
78
+ // Function: svgedit.history.MoveElementCommand.getText
79
+ svgedit.history.MoveElementCommand.prototype.getText = function() {
80
+ return this.text;
81
+ };
82
+
83
+ // Function: svgedit.history.MoveElementCommand.apply
84
+ // Re-positions the element
85
+ svgedit.history.MoveElementCommand.prototype.apply = function(handler) {
86
+ // TODO(codedread): Refactor this common event code into a base HistoryCommand class.
87
+ if (handler) {
88
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this);
89
+ }
90
+
91
+ this.elem = this.newParent.insertBefore(this.elem, this.newNextSibling);
92
+
93
+ if (handler) {
94
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this);
95
+ }
96
+ };
97
+
98
+ // Function: svgedit.history.MoveElementCommand.unapply
99
+ // Positions the element back to its original location
100
+ svgedit.history.MoveElementCommand.prototype.unapply = function(handler) {
101
+ if (handler) {
102
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
103
+ }
104
+
105
+ this.elem = this.oldParent.insertBefore(this.elem, this.oldNextSibling);
106
+
107
+ if (handler) {
108
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this);
109
+ }
110
+ };
111
+
112
+ // Function: svgedit.history.MoveElementCommand.elements
113
+ // Returns array with element associated with this command
114
+ svgedit.history.MoveElementCommand.prototype.elements = function() {
115
+ return [this.elem];
116
+ };
117
+
118
+
119
+ // Class: svgedit.history.InsertElementCommand
120
+ // implements svgedit.history.HistoryCommand
121
+ // History command for an element that was added to the DOM
122
+ //
123
+ // Parameters:
124
+ // elem - The newly added DOM element
125
+ // text - An optional string visible to user related to this change
126
+ svgedit.history.InsertElementCommand = function(elem, text) {
127
+ this.elem = elem;
128
+ this.text = text || ("Create " + elem.tagName);
129
+ this.parent = elem.parentNode;
130
+ this.nextSibling = this.elem.nextSibling;
131
+ };
132
+ svgedit.history.InsertElementCommand.type = function() { return 'svgedit.history.InsertElementCommand'; }
133
+ svgedit.history.InsertElementCommand.prototype.type = svgedit.history.InsertElementCommand.type;
134
+
135
+ // Function: svgedit.history.InsertElementCommand.getText
136
+ svgedit.history.InsertElementCommand.prototype.getText = function() {
137
+ return this.text;
138
+ };
139
+
140
+ // Function: svgedit.history.InsertElementCommand.apply
141
+ // Re-Inserts the new element
142
+ svgedit.history.InsertElementCommand.prototype.apply = function(handler) {
143
+ if (handler) {
144
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this);
145
+ }
146
+
147
+ this.elem = this.parent.insertBefore(this.elem, this.nextSibling);
148
+
149
+ if (handler) {
150
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this);
151
+ }
152
+ };
153
+
154
+ // Function: svgedit.history.InsertElementCommand.unapply
155
+ // Removes the element
156
+ svgedit.history.InsertElementCommand.prototype.unapply = function(handler) {
157
+ if (handler) {
158
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
159
+ }
160
+
161
+ this.parent = this.elem.parentNode;
162
+ this.elem = this.elem.parentNode.removeChild(this.elem);
163
+
164
+ if (handler) {
165
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this);
166
+ }
167
+ };
168
+
169
+ // Function: svgedit.history.InsertElementCommand.elements
170
+ // Returns array with element associated with this command
171
+ svgedit.history.InsertElementCommand.prototype.elements = function() {
172
+ return [this.elem];
173
+ };
174
+
175
+
176
+ // Class: svgedit.history.RemoveElementCommand
177
+ // implements svgedit.history.HistoryCommand
178
+ // History command for an element removed from the DOM
179
+ //
180
+ // Parameters:
181
+ // elem - The removed DOM element
182
+ // oldNextSibling - the DOM element's nextSibling when it was in the DOM
183
+ // oldParent - The DOM element's parent
184
+ // text - An optional string visible to user related to this change
185
+ svgedit.history.RemoveElementCommand = function(elem, oldNextSibling, oldParent, text) {
186
+ this.elem = elem;
187
+ this.text = text || ("Delete " + elem.tagName);
188
+ this.nextSibling = oldNextSibling;
189
+ this.parent = oldParent;
190
+
191
+ // special hack for webkit: remove this element's entry in the svgTransformLists map
192
+ svgedit.transformlist.removeElementFromListMap(elem);
193
+ };
194
+ svgedit.history.RemoveElementCommand.type = function() { return 'svgedit.history.RemoveElementCommand'; }
195
+ svgedit.history.RemoveElementCommand.prototype.type = svgedit.history.RemoveElementCommand.type;
196
+
197
+ // Function: svgedit.history.RemoveElementCommand.getText
198
+ svgedit.history.RemoveElementCommand.prototype.getText = function() {
199
+ return this.text;
200
+ };
201
+
202
+ // Function: RemoveElementCommand.apply
203
+ // Re-removes the new element
204
+ svgedit.history.RemoveElementCommand.prototype.apply = function(handler) {
205
+ if (handler) {
206
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this);
207
+ }
208
+
209
+ svgedit.transformlist.removeElementFromListMap(this.elem);
210
+ this.parent = this.elem.parentNode;
211
+ this.elem = this.parent.removeChild(this.elem);
212
+
213
+ if (handler) {
214
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this);
215
+ }
216
+ };
217
+
218
+ // Function: RemoveElementCommand.unapply
219
+ // Re-adds the new element
220
+ svgedit.history.RemoveElementCommand.prototype.unapply = function(handler) {
221
+ if (handler) {
222
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
223
+ }
224
+
225
+ svgedit.transformlist.removeElementFromListMap(this.elem);
226
+ if(this.nextSibling == null) {
227
+ if(window.console) console.log('Error: reference element was lost');
228
+ }
229
+ this.parent.insertBefore(this.elem, this.nextSibling);
230
+
231
+
232
+ if (handler) {
233
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this);
234
+ }
235
+ };
236
+
237
+ // Function: RemoveElementCommand.elements
238
+ // Returns array with element associated with this command
239
+ svgedit.history.RemoveElementCommand.prototype.elements = function() {
240
+ return [this.elem];
241
+ };
242
+
243
+
244
+ // Class: svgedit.history.ChangeElementCommand
245
+ // implements svgedit.history.HistoryCommand
246
+ // History command to make a change to an element.
247
+ // Usually an attribute change, but can also be textcontent.
248
+ //
249
+ // Parameters:
250
+ // elem - The DOM element that was changed
251
+ // attrs - An object with the attributes to be changed and the values they had *before* the change
252
+ // text - An optional string visible to user related to this change
253
+ svgedit.history.ChangeElementCommand = function(elem, attrs, text) {
254
+ this.elem = elem;
255
+ this.text = text ? ("Change " + elem.tagName + " " + text) : ("Change " + elem.tagName);
256
+ this.newValues = {};
257
+ this.oldValues = attrs;
258
+ for (var attr in attrs) {
259
+ if (attr == "#text") this.newValues[attr] = elem.textContent;
260
+ else if (attr == "#href") this.newValues[attr] = svgedit.utilities.getHref(elem);
261
+ else this.newValues[attr] = elem.getAttribute(attr);
262
+ }
263
+ };
264
+ svgedit.history.ChangeElementCommand.type = function() { return 'svgedit.history.ChangeElementCommand'; }
265
+ svgedit.history.ChangeElementCommand.prototype.type = svgedit.history.ChangeElementCommand.type;
266
+
267
+ // Function: svgedit.history.ChangeElementCommand.getText
268
+ svgedit.history.ChangeElementCommand.prototype.getText = function() {
269
+ return this.text;
270
+ };
271
+
272
+ // Function: svgedit.history.ChangeElementCommand.apply
273
+ // Performs the stored change action
274
+ svgedit.history.ChangeElementCommand.prototype.apply = function(handler) {
275
+ if (handler) {
276
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this);
277
+ }
278
+
279
+ var bChangedTransform = false;
280
+ for(var attr in this.newValues ) {
281
+ if (this.newValues[attr]) {
282
+ if (attr == "#text") this.elem.textContent = this.newValues[attr];
283
+ else if (attr == "#href") svgedit.utilities.setHref(this.elem, this.newValues[attr])
284
+ else this.elem.setAttribute(attr, this.newValues[attr]);
285
+ }
286
+ else {
287
+ if (attr == "#text") {
288
+ this.elem.textContent = "";
289
+ }
290
+ else {
291
+ this.elem.setAttribute(attr, "");
292
+ this.elem.removeAttribute(attr);
293
+ }
294
+ }
295
+
296
+ if (attr == "transform") { bChangedTransform = true; }
297
+ }
298
+
299
+ // relocate rotational transform, if necessary
300
+ if(!bChangedTransform) {
301
+ var angle = svgedit.utilities.getRotationAngle(this.elem);
302
+ if (angle) {
303
+ var bbox = elem.getBBox();
304
+ var cx = bbox.x + bbox.width/2,
305
+ cy = bbox.y + bbox.height/2;
306
+ var rotate = ["rotate(", angle, " ", cx, ",", cy, ")"].join('');
307
+ if (rotate != elem.getAttribute("transform")) {
308
+ elem.setAttribute("transform", rotate);
309
+ }
310
+ }
311
+ }
312
+
313
+ if (handler) {
314
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this);
315
+ }
316
+
317
+ return true;
318
+ };
319
+
320
+ // Function: svgedit.history.ChangeElementCommand.unapply
321
+ // Reverses the stored change action
322
+ svgedit.history.ChangeElementCommand.prototype.unapply = function(handler) {
323
+ if (handler) {
324
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
325
+ }
326
+
327
+ var bChangedTransform = false;
328
+ for(var attr in this.oldValues ) {
329
+ if (this.oldValues[attr]) {
330
+ if (attr == "#text") this.elem.textContent = this.oldValues[attr];
331
+ else if (attr == "#href") svgedit.utilities.setHref(this.elem, this.oldValues[attr]);
332
+ else this.elem.setAttribute(attr, this.oldValues[attr]);
333
+ }
334
+ else {
335
+ if (attr == "#text") {
336
+ this.elem.textContent = "";
337
+ }
338
+ else this.elem.removeAttribute(attr);
339
+ }
340
+ if (attr == "transform") { bChangedTransform = true; }
341
+ }
342
+ // relocate rotational transform, if necessary
343
+ if(!bChangedTransform) {
344
+ var angle = svgedit.utilities.getRotationAngle(this.elem);
345
+ if (angle) {
346
+ var bbox = this.elem.getBBox();
347
+ var cx = bbox.x + bbox.width/2,
348
+ cy = bbox.y + bbox.height/2;
349
+ var rotate = ["rotate(", angle, " ", cx, ",", cy, ")"].join('');
350
+ if (rotate != this.elem.getAttribute("transform")) {
351
+ this.elem.setAttribute("transform", rotate);
352
+ }
353
+ }
354
+ }
355
+
356
+ // Remove transformlist to prevent confusion that causes bugs like 575.
357
+ svgedit.transformlist.removeElementFromListMap(this.elem);
358
+
359
+ if (handler) {
360
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this);
361
+ }
362
+
363
+ return true;
364
+ };
365
+
366
+ // Function: ChangeElementCommand.elements
367
+ // Returns array with element associated with this command
368
+ svgedit.history.ChangeElementCommand.prototype.elements = function() {
369
+ return [this.elem];
370
+ };
371
+
372
+
373
+ // TODO: create a 'typing' command object that tracks changes in text
374
+ // if a new Typing command is created and the top command on the stack is also a Typing
375
+ // and they both affect the same element, then collapse the two commands into one
376
+
377
+
378
+ // Class: svgedit.history.BatchCommand
379
+ // implements svgedit.history.HistoryCommand
380
+ // History command that can contain/execute multiple other commands
381
+ //
382
+ // Parameters:
383
+ // text - An optional string visible to user related to this change
384
+ svgedit.history.BatchCommand = function(text) {
385
+ this.text = text || "Batch Command";
386
+ this.stack = [];
387
+ };
388
+ svgedit.history.BatchCommand.type = function() { return 'svgedit.history.BatchCommand'; }
389
+ svgedit.history.BatchCommand.prototype.type = svgedit.history.BatchCommand.type;
390
+
391
+ // Function: svgedit.history.BatchCommand.getText
392
+ svgedit.history.BatchCommand.prototype.getText = function() {
393
+ return this.text;
394
+ };
395
+
396
+ // Function: svgedit.history.BatchCommand.apply
397
+ // Runs "apply" on all subcommands
398
+ svgedit.history.BatchCommand.prototype.apply = function(handler) {
399
+ if (handler) {
400
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY, this);
401
+ }
402
+
403
+ var len = this.stack.length;
404
+ for (var i = 0; i < len; ++i) {
405
+ this.stack[i].apply(handler);
406
+ }
407
+
408
+ if (handler) {
409
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this);
410
+ }
411
+ };
412
+
413
+ // Function: svgedit.history.BatchCommand.unapply
414
+ // Runs "unapply" on all subcommands
415
+ svgedit.history.BatchCommand.prototype.unapply = function(handler) {
416
+ if (handler) {
417
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);
418
+ }
419
+
420
+ for (var i = this.stack.length-1; i >= 0; i--) {
421
+ this.stack[i].unapply(handler);
422
+ }
423
+
424
+ if (handler) {
425
+ handler.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this);
426
+ }
427
+ };
428
+
429
+ // Function: svgedit.history.BatchCommand.elements
430
+ // Iterate through all our subcommands and returns all the elements we are changing
431
+ svgedit.history.BatchCommand.prototype.elements = function() {
432
+ var elems = [];
433
+ var cmd = this.stack.length;
434
+ while (cmd--) {
435
+ var thisElems = this.stack[cmd].elements();
436
+ var elem = thisElems.length;
437
+ while (elem--) {
438
+ if (elems.indexOf(thisElems[elem]) == -1) elems.push(thisElems[elem]);
439
+ }
440
+ }
441
+ return elems;
442
+ };
443
+
444
+ // Function: svgedit.history.BatchCommand.addSubCommand
445
+ // Adds a given command to the history stack
446
+ //
447
+ // Parameters:
448
+ // cmd - The undo command object to add
449
+ svgedit.history.BatchCommand.prototype.addSubCommand = function(cmd) {
450
+ this.stack.push(cmd);
451
+ };
452
+
453
+ // Function: svgedit.history.BatchCommand.isEmpty
454
+ // Returns a boolean indicating whether or not the batch command is empty
455
+ svgedit.history.BatchCommand.prototype.isEmpty = function() {
456
+ return this.stack.length == 0;
457
+ };
458
+
459
+
460
+ // Class: svgedit.history.UndoManager
461
+ // Parameters:
462
+ // historyEventHandler - an object that conforms to the HistoryEventHandler interface
463
+ // (see above)
464
+ svgedit.history.UndoManager = function(historyEventHandler) {
465
+ this.handler_ = historyEventHandler || null;
466
+ this.undoStackPointer = 0;
467
+ this.undoStack = [];
468
+
469
+ // this is the stack that stores the original values, the elements and
470
+ // the attribute name for begin/finish
471
+ this.undoChangeStackPointer = -1;
472
+ this.undoableChangeStack = [];
473
+ };
474
+
475
+ // Function: svgedit.history.UndoManager.resetUndoStack
476
+ // Resets the undo stack, effectively clearing the undo/redo history
477
+ svgedit.history.UndoManager.prototype.resetUndoStack = function() {
478
+ this.undoStack = [];
479
+ this.undoStackPointer = 0;
480
+ };
481
+
482
+ // Function: svgedit.history.UndoManager.getUndoStackSize
483
+ // Returns:
484
+ // Integer with the current size of the undo history stack
485
+ svgedit.history.UndoManager.prototype.getUndoStackSize = function() {
486
+ return this.undoStackPointer;
487
+ };
488
+
489
+ // Function: svgedit.history.UndoManager.getRedoStackSize
490
+ // Returns:
491
+ // Integer with the current size of the redo history stack
492
+ svgedit.history.UndoManager.prototype.getRedoStackSize = function() {
493
+ return this.undoStack.length - this.undoStackPointer;
494
+ };
495
+
496
+ // Function: svgedit.history.UndoManager.getNextUndoCommandText
497
+ // Returns:
498
+ // String associated with the next undo command
499
+ svgedit.history.UndoManager.prototype.getNextUndoCommandText = function() {
500
+ return this.undoStackPointer > 0 ? this.undoStack[this.undoStackPointer-1].getText() : "";
501
+ };
502
+
503
+ // Function: svgedit.history.UndoManager.getNextRedoCommandText
504
+ // Returns:
505
+ // String associated with the next redo command
506
+ svgedit.history.UndoManager.prototype.getNextRedoCommandText = function() {
507
+ return this.undoStackPointer < this.undoStack.length ? this.undoStack[this.undoStackPointer].getText() : "";
508
+ };
509
+
510
+ // Function: svgedit.history.UndoManager.undo
511
+ // Performs an undo step
512
+ svgedit.history.UndoManager.prototype.undo = function() {
513
+ if (this.undoStackPointer > 0) {
514
+ var cmd = this.undoStack[--this.undoStackPointer];
515
+ cmd.unapply(this.handler_);
516
+ }
517
+ };
518
+
519
+ // Function: svgedit.history.UndoManager.redo
520
+ // Performs a redo step
521
+ svgedit.history.UndoManager.prototype.redo = function() {
522
+ if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) {
523
+ var cmd = this.undoStack[this.undoStackPointer++];
524
+ cmd.apply(this.handler_);
525
+ }
526
+ };
527
+
528
+ // Function: svgedit.history.UndoManager.addCommandToHistory
529
+ // Adds a command object to the undo history stack
530
+ //
531
+ // Parameters:
532
+ // cmd - The command object to add
533
+ svgedit.history.UndoManager.prototype.addCommandToHistory = function(cmd) {
534
+ // FIXME: we MUST compress consecutive text changes to the same element
535
+ // (right now each keystroke is saved as a separate command that includes the
536
+ // entire text contents of the text element)
537
+ // TODO: consider limiting the history that we store here (need to do some slicing)
538
+
539
+ // if our stack pointer is not at the end, then we have to remove
540
+ // all commands after the pointer and insert the new command
541
+ if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) {
542
+ this.undoStack = this.undoStack.splice(0, this.undoStackPointer);
543
+ }
544
+ this.undoStack.push(cmd);
545
+ this.undoStackPointer = this.undoStack.length;
546
+ };
547
+
548
+
549
+ // Function: svgedit.history.UndoManager.beginUndoableChange
550
+ // This function tells the canvas to remember the old values of the
551
+ // attrName attribute for each element sent in. The elements and values
552
+ // are stored on a stack, so the next call to finishUndoableChange() will
553
+ // pop the elements and old values off the stack, gets the current values
554
+ // from the DOM and uses all of these to construct the undo-able command.
555
+ //
556
+ // Parameters:
557
+ // attrName - The name of the attribute being changed
558
+ // elems - Array of DOM elements being changed
559
+ svgedit.history.UndoManager.prototype.beginUndoableChange = function(attrName, elems) {
560
+ var p = ++this.undoChangeStackPointer;
561
+ var i = elems.length;
562
+ var oldValues = new Array(i), elements = new Array(i);
563
+ while (i--) {
564
+ var elem = elems[i];
565
+ if (elem == null) continue;
566
+ elements[i] = elem;
567
+ oldValues[i] = elem.getAttribute(attrName);
568
+ }
569
+ this.undoableChangeStack[p] = {'attrName': attrName,
570
+ 'oldValues': oldValues,
571
+ 'elements': elements};
572
+ };
573
+
574
+ // Function: svgedit.history.UndoManager.finishUndoableChange
575
+ // This function returns a BatchCommand object which summarizes the
576
+ // change since beginUndoableChange was called. The command can then
577
+ // be added to the command history
578
+ //
579
+ // Returns:
580
+ // Batch command object with resulting changes
581
+ svgedit.history.UndoManager.prototype.finishUndoableChange = function() {
582
+ var p = this.undoChangeStackPointer--;
583
+ var changeset = this.undoableChangeStack[p];
584
+ var i = changeset['elements'].length;
585
+ var attrName = changeset['attrName'];
586
+ var batchCmd = new svgedit.history.BatchCommand("Change " + attrName);
587
+ while (i--) {
588
+ var elem = changeset['elements'][i];
589
+ if (elem == null) continue;
590
+ var changes = {};
591
+ changes[attrName] = changeset['oldValues'][i];
592
+ if (changes[attrName] != elem.getAttribute(attrName)) {
593
+ batchCmd.addSubCommand(new svgedit.history.ChangeElementCommand(elem, changes, attrName));
594
+ }
595
+ }
596
+ this.undoableChangeStack[p] = null;
597
+ return batchCmd;
598
+ };
599
+
600
+
601
+ })();