ding-image-editor 3.15.3
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.
- package/README.md +193 -0
- package/dist/svg/icon-a.svg +376 -0
- package/dist/svg/icon-b.svg +369 -0
- package/dist/svg/icon-c.svg +369 -0
- package/dist/svg/icon-d.svg +369 -0
- package/dist/tui-image-editor.css +6 -0
- package/dist/tui-image-editor.js +62329 -0
- package/dist/tui-image-editor.min.css +5 -0
- package/dist/tui-image-editor.min.js +15 -0
- package/index.d.ts +334 -0
- package/package.json +52 -0
- package/src/css/buttons.styl +102 -0
- package/src/css/checkbox.styl +86 -0
- package/src/css/colorpicker.styl +98 -0
- package/src/css/gridtable.styl +45 -0
- package/src/css/icon.styl +44 -0
- package/src/css/index.styl +17 -0
- package/src/css/main.styl +163 -0
- package/src/css/position.styl +309 -0
- package/src/css/range.styl +91 -0
- package/src/css/submenu.styl +168 -0
- package/src/index.js +29 -0
- package/src/js/action.js +686 -0
- package/src/js/command/addIcon.js +42 -0
- package/src/js/command/addImageObject.js +34 -0
- package/src/js/command/addObject.js +43 -0
- package/src/js/command/addShape.js +51 -0
- package/src/js/command/addText.js +73 -0
- package/src/js/command/applyFilter.js +95 -0
- package/src/js/command/changeIconColor.js +48 -0
- package/src/js/command/changeSelection.js +31 -0
- package/src/js/command/changeShape.js +84 -0
- package/src/js/command/changeText.js +44 -0
- package/src/js/command/changeTextStyle.js +80 -0
- package/src/js/command/clearObjects.js +33 -0
- package/src/js/command/flip.js +36 -0
- package/src/js/command/loadImage.js +58 -0
- package/src/js/command/removeFilter.js +38 -0
- package/src/js/command/removeObject.js +37 -0
- package/src/js/command/resize.js +41 -0
- package/src/js/command/resizeCanvasDimension.js +40 -0
- package/src/js/command/rotate.js +64 -0
- package/src/js/command/setObjectPosition.js +50 -0
- package/src/js/command/setObjectProperties.js +55 -0
- package/src/js/component/cropper.js +407 -0
- package/src/js/component/filter.js +229 -0
- package/src/js/component/flip.js +146 -0
- package/src/js/component/freeDrawing.js +144 -0
- package/src/js/component/icon.js +246 -0
- package/src/js/component/imageLoader.js +84 -0
- package/src/js/component/line.js +205 -0
- package/src/js/component/resize.js +103 -0
- package/src/js/component/rotation.js +91 -0
- package/src/js/component/shape.js +601 -0
- package/src/js/component/text.js +572 -0
- package/src/js/component/zoom.js +708 -0
- package/src/js/consts.js +404 -0
- package/src/js/drawingMode/cropper.js +35 -0
- package/src/js/drawingMode/freeDrawing.js +36 -0
- package/src/js/drawingMode/icon.js +35 -0
- package/src/js/drawingMode/lineDrawing.js +36 -0
- package/src/js/drawingMode/resize.js +35 -0
- package/src/js/drawingMode/shape.js +35 -0
- package/src/js/drawingMode/text.js +35 -0
- package/src/js/drawingMode/zoom.js +37 -0
- package/src/js/extension/arrowLine.js +172 -0
- package/src/js/extension/blur.js +29 -0
- package/src/js/extension/colorFilter.js +104 -0
- package/src/js/extension/cropzone.js +568 -0
- package/src/js/extension/emboss.js +29 -0
- package/src/js/extension/mask.js +90 -0
- package/src/js/extension/sharpen.js +29 -0
- package/src/js/factory/command.js +36 -0
- package/src/js/factory/errorMessage.js +27 -0
- package/src/js/graphics.js +1539 -0
- package/src/js/helper/imagetracer.js +1396 -0
- package/src/js/helper/selectionModifyHelper.js +86 -0
- package/src/js/helper/shapeFilterFillHelper.js +564 -0
- package/src/js/helper/shapeResizeHelper.js +237 -0
- package/src/js/imageEditor.js +1795 -0
- package/src/js/interface/command.js +131 -0
- package/src/js/interface/component.js +127 -0
- package/src/js/interface/drawingMode.js +47 -0
- package/src/js/invoker.js +292 -0
- package/src/js/polyfill.js +498 -0
- package/src/js/ui/crop.js +139 -0
- package/src/js/ui/draw.js +187 -0
- package/src/js/ui/filter.js +510 -0
- package/src/js/ui/flip.js +87 -0
- package/src/js/ui/history.js +171 -0
- package/src/js/ui/icon.js +191 -0
- package/src/js/ui/locale/locale.js +19 -0
- package/src/js/ui/mask.js +96 -0
- package/src/js/ui/panelMenu.js +130 -0
- package/src/js/ui/resize.js +241 -0
- package/src/js/ui/rotate.js +123 -0
- package/src/js/ui/shape.js +265 -0
- package/src/js/ui/submenuBase.js +122 -0
- package/src/js/ui/template/controls.js +21 -0
- package/src/js/ui/template/mainContainer.js +38 -0
- package/src/js/ui/template/style.js +146 -0
- package/src/js/ui/template/submenu/crop.js +73 -0
- package/src/js/ui/template/submenu/draw.js +42 -0
- package/src/js/ui/template/submenu/filter.js +157 -0
- package/src/js/ui/template/submenu/flip.js +41 -0
- package/src/js/ui/template/submenu/history.js +22 -0
- package/src/js/ui/template/submenu/icon.js +108 -0
- package/src/js/ui/template/submenu/mask.js +30 -0
- package/src/js/ui/template/submenu/resize.js +54 -0
- package/src/js/ui/template/submenu/rotate.js +32 -0
- package/src/js/ui/template/submenu/shape.js +45 -0
- package/src/js/ui/template/submenu/text.js +67 -0
- package/src/js/ui/template/submenu/zoom.js +41 -0
- package/src/js/ui/text.js +279 -0
- package/src/js/ui/theme/standard.js +220 -0
- package/src/js/ui/theme/theme.js +249 -0
- package/src/js/ui/tools/colorpicker.js +250 -0
- package/src/js/ui/tools/range.js +390 -0
- package/src/js/ui.js +858 -0
- package/src/js/util.js +551 -0
- package/src/svg/default.svg +335 -0
- package/src/svg/icon-a/ic-apply.svg +6 -0
- package/src/svg/icon-a/ic-cancel.svg +6 -0
- package/src/svg/icon-a/ic-color-transparent-w.svg +12 -0
- package/src/svg/icon-a/ic-crop.svg +7 -0
- package/src/svg/icon-a/ic-delete-all.svg +6 -0
- package/src/svg/icon-a/ic-delete.svg +6 -0
- package/src/svg/icon-a/ic-draw-free.svg +5 -0
- package/src/svg/icon-a/ic-draw-line.svg +5 -0
- package/src/svg/icon-a/ic-draw.svg +6 -0
- package/src/svg/icon-a/ic-filter.svg +7 -0
- package/src/svg/icon-a/ic-flip-reset.svg +7 -0
- package/src/svg/icon-a/ic-flip-x.svg +6 -0
- package/src/svg/icon-a/ic-flip-y.svg +6 -0
- package/src/svg/icon-a/ic-flip.svg +6 -0
- package/src/svg/icon-a/ic-history-check.svg +5 -0
- package/src/svg/icon-a/ic-history-crop.svg +7 -0
- package/src/svg/icon-a/ic-history-delete.svg +9 -0
- package/src/svg/icon-a/ic-history-draw.svg +7 -0
- package/src/svg/icon-a/ic-history-filter.svg +8 -0
- package/src/svg/icon-a/ic-history-flip.svg +6 -0
- package/src/svg/icon-a/ic-history-group.svg +9 -0
- package/src/svg/icon-a/ic-history-icon.svg +6 -0
- package/src/svg/icon-a/ic-history-load.svg +7 -0
- package/src/svg/icon-a/ic-history-mask.svg +9 -0
- package/src/svg/icon-a/ic-history-resize.svg +12 -0
- package/src/svg/icon-a/ic-history-rotate.svg +16 -0
- package/src/svg/icon-a/ic-history-shape.svg +7 -0
- package/src/svg/icon-a/ic-history-text.svg +8 -0
- package/src/svg/icon-a/ic-history.svg +6 -0
- package/src/svg/icon-a/ic-icon-arrow-2.svg +5 -0
- package/src/svg/icon-a/ic-icon-arrow-3.svg +5 -0
- package/src/svg/icon-a/ic-icon-arrow.svg +5 -0
- package/src/svg/icon-a/ic-icon-bubble.svg +5 -0
- package/src/svg/icon-a/ic-icon-heart.svg +5 -0
- package/src/svg/icon-a/ic-icon-load.svg +8 -0
- package/src/svg/icon-a/ic-icon-location.svg +8 -0
- package/src/svg/icon-a/ic-icon-polygon.svg +5 -0
- package/src/svg/icon-a/ic-icon-star-2.svg +5 -0
- package/src/svg/icon-a/ic-icon-star.svg +5 -0
- package/src/svg/icon-a/ic-icon.svg +5 -0
- package/src/svg/icon-a/ic-mask-load.svg +8 -0
- package/src/svg/icon-a/ic-mask.svg +6 -0
- package/src/svg/icon-a/ic-redo.svg +7 -0
- package/src/svg/icon-a/ic-reset.svg +7 -0
- package/src/svg/icon-a/ic-resize.svg +13 -0
- package/src/svg/icon-a/ic-rotate-clockwise.svg +7 -0
- package/src/svg/icon-a/ic-rotate-counterclockwise.svg +7 -0
- package/src/svg/icon-a/ic-rotate.svg +7 -0
- package/src/svg/icon-a/ic-shape-circle.svg +5 -0
- package/src/svg/icon-a/ic-shape-rectangle.svg +5 -0
- package/src/svg/icon-a/ic-shape-triangle.svg +5 -0
- package/src/svg/icon-a/ic-shape.svg +6 -0
- package/src/svg/icon-a/ic-text-align-center.svg +6 -0
- package/src/svg/icon-a/ic-text-align-left.svg +6 -0
- package/src/svg/icon-a/ic-text-align-right.svg +6 -0
- package/src/svg/icon-a/ic-text-bold.svg +7 -0
- package/src/svg/icon-a/ic-text-italic.svg +6 -0
- package/src/svg/icon-a/ic-text-underline.svg +7 -0
- package/src/svg/icon-a/ic-text.svg +7 -0
- package/src/svg/icon-a/ic-undo.svg +7 -0
- package/src/svg/icon-a/ic-zoom-hand.svg +8 -0
- package/src/svg/icon-a/ic-zoom-zoom-in.svg +10 -0
- package/src/svg/icon-a/ic-zoom-zoom-out.svg +9 -0
- package/src/svg/icon-a/img-bi.svg +5 -0
- package/src/svg/icon-b/ic-apply.svg +6 -0
- package/src/svg/icon-b/ic-cancel.svg +6 -0
- package/src/svg/icon-b/ic-crop.svg +7 -0
- package/src/svg/icon-b/ic-delete-all.svg +6 -0
- package/src/svg/icon-b/ic-delete.svg +6 -0
- package/src/svg/icon-b/ic-draw-free.svg +5 -0
- package/src/svg/icon-b/ic-draw-line.svg +5 -0
- package/src/svg/icon-b/ic-draw.svg +6 -0
- package/src/svg/icon-b/ic-filter.svg +7 -0
- package/src/svg/icon-b/ic-flip-reset.svg +7 -0
- package/src/svg/icon-b/ic-flip-x.svg +6 -0
- package/src/svg/icon-b/ic-flip-y.svg +6 -0
- package/src/svg/icon-b/ic-flip.svg +6 -0
- package/src/svg/icon-b/ic-history-check.svg +5 -0
- package/src/svg/icon-b/ic-history-crop.svg +7 -0
- package/src/svg/icon-b/ic-history-delete.svg +9 -0
- package/src/svg/icon-b/ic-history-draw.svg +7 -0
- package/src/svg/icon-b/ic-history-filter.svg +8 -0
- package/src/svg/icon-b/ic-history-flip.svg +6 -0
- package/src/svg/icon-b/ic-history-group.svg +9 -0
- package/src/svg/icon-b/ic-history-icon.svg +6 -0
- package/src/svg/icon-b/ic-history-load.svg +7 -0
- package/src/svg/icon-b/ic-history-mask.svg +9 -0
- package/src/svg/icon-b/ic-history-resize.svg +12 -0
- package/src/svg/icon-b/ic-history-rotate.svg +16 -0
- package/src/svg/icon-b/ic-history-shape.svg +7 -0
- package/src/svg/icon-b/ic-history-text.svg +8 -0
- package/src/svg/icon-b/ic-history.svg +6 -0
- package/src/svg/icon-b/ic-icon-arrow-2.svg +5 -0
- package/src/svg/icon-b/ic-icon-arrow-3.svg +5 -0
- package/src/svg/icon-b/ic-icon-arrow.svg +5 -0
- package/src/svg/icon-b/ic-icon-bubble.svg +5 -0
- package/src/svg/icon-b/ic-icon-heart.svg +5 -0
- package/src/svg/icon-b/ic-icon-load.svg +8 -0
- package/src/svg/icon-b/ic-icon-location.svg +8 -0
- package/src/svg/icon-b/ic-icon-polygon.svg +5 -0
- package/src/svg/icon-b/ic-icon-star-2.svg +5 -0
- package/src/svg/icon-b/ic-icon-star.svg +5 -0
- package/src/svg/icon-b/ic-icon.svg +5 -0
- package/src/svg/icon-b/ic-mask-load.svg +8 -0
- package/src/svg/icon-b/ic-mask.svg +6 -0
- package/src/svg/icon-b/ic-redo.svg +7 -0
- package/src/svg/icon-b/ic-reset.svg +7 -0
- package/src/svg/icon-b/ic-resize.svg +13 -0
- package/src/svg/icon-b/ic-rotate-clockwise.svg +7 -0
- package/src/svg/icon-b/ic-rotate-counterclockwise.svg +7 -0
- package/src/svg/icon-b/ic-rotate.svg +7 -0
- package/src/svg/icon-b/ic-shape-circle.svg +5 -0
- package/src/svg/icon-b/ic-shape-rectangle.svg +5 -0
- package/src/svg/icon-b/ic-shape-triangle.svg +5 -0
- package/src/svg/icon-b/ic-shape.svg +6 -0
- package/src/svg/icon-b/ic-text-align-center.svg +6 -0
- package/src/svg/icon-b/ic-text-align-left.svg +6 -0
- package/src/svg/icon-b/ic-text-align-right.svg +6 -0
- package/src/svg/icon-b/ic-text-bold.svg +7 -0
- package/src/svg/icon-b/ic-text-italic.svg +6 -0
- package/src/svg/icon-b/ic-text-underline.svg +7 -0
- package/src/svg/icon-b/ic-text.svg +7 -0
- package/src/svg/icon-b/ic-undo.svg +7 -0
- package/src/svg/icon-b/ic-zoom-hand.svg +8 -0
- package/src/svg/icon-b/ic-zoom-zoom-in.svg +12 -0
- package/src/svg/icon-b/ic-zoom-zoom-out.svg +11 -0
- package/src/svg/icon-b/img-bi.svg +5 -0
- package/src/svg/icon-c/ic-apply.svg +6 -0
- package/src/svg/icon-c/ic-cancel.svg +6 -0
- package/src/svg/icon-c/ic-crop.svg +7 -0
- package/src/svg/icon-c/ic-delete-all.svg +6 -0
- package/src/svg/icon-c/ic-delete.svg +6 -0
- package/src/svg/icon-c/ic-draw-free.svg +5 -0
- package/src/svg/icon-c/ic-draw-line.svg +5 -0
- package/src/svg/icon-c/ic-draw.svg +6 -0
- package/src/svg/icon-c/ic-filter.svg +7 -0
- package/src/svg/icon-c/ic-flip-reset.svg +7 -0
- package/src/svg/icon-c/ic-flip-x.svg +6 -0
- package/src/svg/icon-c/ic-flip-y.svg +6 -0
- package/src/svg/icon-c/ic-flip.svg +6 -0
- package/src/svg/icon-c/ic-history-check.svg +5 -0
- package/src/svg/icon-c/ic-history-crop.svg +7 -0
- package/src/svg/icon-c/ic-history-delete.svg +9 -0
- package/src/svg/icon-c/ic-history-draw.svg +7 -0
- package/src/svg/icon-c/ic-history-filter.svg +8 -0
- package/src/svg/icon-c/ic-history-flip.svg +6 -0
- package/src/svg/icon-c/ic-history-group.svg +9 -0
- package/src/svg/icon-c/ic-history-icon.svg +6 -0
- package/src/svg/icon-c/ic-history-load.svg +7 -0
- package/src/svg/icon-c/ic-history-mask.svg +9 -0
- package/src/svg/icon-c/ic-history-resize.svg +12 -0
- package/src/svg/icon-c/ic-history-rotate.svg +16 -0
- package/src/svg/icon-c/ic-history-shape.svg +7 -0
- package/src/svg/icon-c/ic-history-text.svg +8 -0
- package/src/svg/icon-c/ic-history.svg +6 -0
- package/src/svg/icon-c/ic-icon-arrow-2.svg +5 -0
- package/src/svg/icon-c/ic-icon-arrow-3.svg +5 -0
- package/src/svg/icon-c/ic-icon-arrow.svg +5 -0
- package/src/svg/icon-c/ic-icon-bubble.svg +5 -0
- package/src/svg/icon-c/ic-icon-heart.svg +5 -0
- package/src/svg/icon-c/ic-icon-load.svg +8 -0
- package/src/svg/icon-c/ic-icon-location.svg +8 -0
- package/src/svg/icon-c/ic-icon-polygon.svg +5 -0
- package/src/svg/icon-c/ic-icon-star-2.svg +5 -0
- package/src/svg/icon-c/ic-icon-star.svg +5 -0
- package/src/svg/icon-c/ic-icon.svg +5 -0
- package/src/svg/icon-c/ic-mask-load.svg +8 -0
- package/src/svg/icon-c/ic-mask.svg +6 -0
- package/src/svg/icon-c/ic-redo.svg +7 -0
- package/src/svg/icon-c/ic-reset.svg +7 -0
- package/src/svg/icon-c/ic-resize.svg +13 -0
- package/src/svg/icon-c/ic-rotate-clockwise.svg +7 -0
- package/src/svg/icon-c/ic-rotate-counterclockwise.svg +7 -0
- package/src/svg/icon-c/ic-rotate.svg +7 -0
- package/src/svg/icon-c/ic-shape-circle.svg +5 -0
- package/src/svg/icon-c/ic-shape-rectangle.svg +5 -0
- package/src/svg/icon-c/ic-shape-triangle.svg +5 -0
- package/src/svg/icon-c/ic-shape.svg +6 -0
- package/src/svg/icon-c/ic-text-align-center.svg +6 -0
- package/src/svg/icon-c/ic-text-align-left.svg +6 -0
- package/src/svg/icon-c/ic-text-align-right.svg +6 -0
- package/src/svg/icon-c/ic-text-bold.svg +7 -0
- package/src/svg/icon-c/ic-text-italic.svg +6 -0
- package/src/svg/icon-c/ic-text-underline.svg +7 -0
- package/src/svg/icon-c/ic-text.svg +7 -0
- package/src/svg/icon-c/ic-undo.svg +7 -0
- package/src/svg/icon-c/ic-zoom-hand.svg +8 -0
- package/src/svg/icon-c/ic-zoom-zoom-in.svg +12 -0
- package/src/svg/icon-c/ic-zoom-zoom-out.svg +11 -0
- package/src/svg/icon-c/img-bi.svg +5 -0
- package/src/svg/icon-d/ic-apply.svg +6 -0
- package/src/svg/icon-d/ic-cancel.svg +6 -0
- package/src/svg/icon-d/ic-crop.svg +7 -0
- package/src/svg/icon-d/ic-delete-all.svg +6 -0
- package/src/svg/icon-d/ic-delete.svg +6 -0
- package/src/svg/icon-d/ic-draw-free.svg +5 -0
- package/src/svg/icon-d/ic-draw-line.svg +5 -0
- package/src/svg/icon-d/ic-draw.svg +6 -0
- package/src/svg/icon-d/ic-filter.svg +7 -0
- package/src/svg/icon-d/ic-flip-reset.svg +7 -0
- package/src/svg/icon-d/ic-flip-x.svg +6 -0
- package/src/svg/icon-d/ic-flip-y.svg +6 -0
- package/src/svg/icon-d/ic-flip.svg +6 -0
- package/src/svg/icon-d/ic-history-check.svg +5 -0
- package/src/svg/icon-d/ic-history-crop.svg +7 -0
- package/src/svg/icon-d/ic-history-delete.svg +9 -0
- package/src/svg/icon-d/ic-history-draw.svg +7 -0
- package/src/svg/icon-d/ic-history-filter.svg +8 -0
- package/src/svg/icon-d/ic-history-flip.svg +6 -0
- package/src/svg/icon-d/ic-history-group.svg +9 -0
- package/src/svg/icon-d/ic-history-icon.svg +6 -0
- package/src/svg/icon-d/ic-history-load.svg +7 -0
- package/src/svg/icon-d/ic-history-mask.svg +9 -0
- package/src/svg/icon-d/ic-history-resize.svg +12 -0
- package/src/svg/icon-d/ic-history-rotate.svg +16 -0
- package/src/svg/icon-d/ic-history-shape.svg +7 -0
- package/src/svg/icon-d/ic-history-text.svg +8 -0
- package/src/svg/icon-d/ic-history.svg +6 -0
- package/src/svg/icon-d/ic-icon-arrow-2.svg +5 -0
- package/src/svg/icon-d/ic-icon-arrow-3.svg +5 -0
- package/src/svg/icon-d/ic-icon-arrow.svg +5 -0
- package/src/svg/icon-d/ic-icon-bubble.svg +5 -0
- package/src/svg/icon-d/ic-icon-heart.svg +5 -0
- package/src/svg/icon-d/ic-icon-load.svg +8 -0
- package/src/svg/icon-d/ic-icon-location.svg +8 -0
- package/src/svg/icon-d/ic-icon-polygon.svg +5 -0
- package/src/svg/icon-d/ic-icon-star-2.svg +5 -0
- package/src/svg/icon-d/ic-icon-star.svg +5 -0
- package/src/svg/icon-d/ic-icon.svg +5 -0
- package/src/svg/icon-d/ic-mask-load.svg +8 -0
- package/src/svg/icon-d/ic-mask.svg +6 -0
- package/src/svg/icon-d/ic-redo.svg +7 -0
- package/src/svg/icon-d/ic-reset.svg +7 -0
- package/src/svg/icon-d/ic-resize.svg +13 -0
- package/src/svg/icon-d/ic-rotate-clockwise.svg +7 -0
- package/src/svg/icon-d/ic-rotate-counterclockwise.svg +7 -0
- package/src/svg/icon-d/ic-rotate.svg +7 -0
- package/src/svg/icon-d/ic-shape-circle.svg +5 -0
- package/src/svg/icon-d/ic-shape-rectangle.svg +5 -0
- package/src/svg/icon-d/ic-shape-triangle.svg +5 -0
- package/src/svg/icon-d/ic-shape.svg +6 -0
- package/src/svg/icon-d/ic-text-align-center.svg +6 -0
- package/src/svg/icon-d/ic-text-align-left.svg +6 -0
- package/src/svg/icon-d/ic-text-align-right.svg +6 -0
- package/src/svg/icon-d/ic-text-bold.svg +7 -0
- package/src/svg/icon-d/ic-text-italic.svg +6 -0
- package/src/svg/icon-d/ic-text-underline.svg +7 -0
- package/src/svg/icon-d/ic-text.svg +7 -0
- package/src/svg/icon-d/ic-undo.svg +7 -0
- package/src/svg/icon-d/ic-zoom-hand.svg +8 -0
- package/src/svg/icon-d/ic-zoom-zoom-in.svg +12 -0
- package/src/svg/icon-d/ic-zoom-zoom-out.svg +11 -0
- package/src/svg/icon-d/img-bi.svg +5 -0
package/src/js/consts.js
ADDED
@@ -0,0 +1,404 @@
|
|
1
|
+
import { keyMirror } from '@/util';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Help features for zoom
|
5
|
+
* @type {Array.<string>}
|
6
|
+
*/
|
7
|
+
export const ZOOM_HELP_MENUS = ['zoomIn', 'zoomOut', 'hand'];
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Help features for command
|
11
|
+
* @type {Array.<string>}
|
12
|
+
*/
|
13
|
+
export const COMMAND_HELP_MENUS = ['history', 'undo', 'redo', 'reset'];
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Help features for delete
|
17
|
+
* @type {Array.<string>}
|
18
|
+
*/
|
19
|
+
export const DELETE_HELP_MENUS = ['delete', 'deleteAll'];
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Editor help features
|
23
|
+
* @type {Array.<string>}
|
24
|
+
*/
|
25
|
+
export const HELP_MENUS = [...ZOOM_HELP_MENUS, ...COMMAND_HELP_MENUS, ...DELETE_HELP_MENUS];
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Fill type for shape
|
29
|
+
* @type {Object.<string, string>}
|
30
|
+
*/
|
31
|
+
export const SHAPE_FILL_TYPE = {
|
32
|
+
FILTER: 'filter',
|
33
|
+
COLOR: 'color',
|
34
|
+
};
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Shape type list
|
38
|
+
* @type {Array.<string>}
|
39
|
+
*/
|
40
|
+
export const SHAPE_TYPE = ['rect', 'circle', 'triangle'];
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Object type
|
44
|
+
* @type {Object.<string, string>}
|
45
|
+
*/
|
46
|
+
export const OBJ_TYPE = {
|
47
|
+
CROPZONE: 'cropzone',
|
48
|
+
};
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Filter type map
|
52
|
+
* @type {Object.<string, string>}
|
53
|
+
*/
|
54
|
+
export const filterType = {
|
55
|
+
VINTAGE: 'vintage',
|
56
|
+
SEPIA2: 'sepia2',
|
57
|
+
REMOVE_COLOR: 'removeColor',
|
58
|
+
COLOR_FILTER: 'colorFilter',
|
59
|
+
REMOVE_WHITE: 'removeWhite',
|
60
|
+
BLEND_COLOR: 'blendColor',
|
61
|
+
BLEND: 'blend',
|
62
|
+
};
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Component names
|
66
|
+
* @type {Object.<string, string>}
|
67
|
+
*/
|
68
|
+
export const componentNames = keyMirror(
|
69
|
+
'IMAGE_LOADER',
|
70
|
+
'CROPPER',
|
71
|
+
'FLIP',
|
72
|
+
'ROTATION',
|
73
|
+
'FREE_DRAWING',
|
74
|
+
'LINE',
|
75
|
+
'TEXT',
|
76
|
+
'ICON',
|
77
|
+
'FILTER',
|
78
|
+
'SHAPE',
|
79
|
+
'ZOOM',
|
80
|
+
'RESIZE'
|
81
|
+
);
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Shape default option
|
85
|
+
* @type {Object}
|
86
|
+
*/
|
87
|
+
export const SHAPE_DEFAULT_OPTIONS = {
|
88
|
+
lockSkewingX: true,
|
89
|
+
lockSkewingY: true,
|
90
|
+
bringForward: true,
|
91
|
+
isRegular: false,
|
92
|
+
};
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Cropzone default option
|
96
|
+
* @type {Object}
|
97
|
+
*/
|
98
|
+
export const CROPZONE_DEFAULT_OPTIONS = {
|
99
|
+
hasRotatingPoint: false,
|
100
|
+
hasBorders: false,
|
101
|
+
lockScalingFlip: true,
|
102
|
+
lockRotation: true,
|
103
|
+
lockSkewingX: true,
|
104
|
+
lockSkewingY: true,
|
105
|
+
};
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Command names
|
109
|
+
* @type {Object.<string, string>}
|
110
|
+
*/
|
111
|
+
export const commandNames = {
|
112
|
+
CLEAR_OBJECTS: 'clearObjects',
|
113
|
+
LOAD_IMAGE: 'loadImage',
|
114
|
+
FLIP_IMAGE: 'flip',
|
115
|
+
ROTATE_IMAGE: 'rotate',
|
116
|
+
ADD_OBJECT: 'addObject',
|
117
|
+
REMOVE_OBJECT: 'removeObject',
|
118
|
+
APPLY_FILTER: 'applyFilter',
|
119
|
+
REMOVE_FILTER: 'removeFilter',
|
120
|
+
ADD_ICON: 'addIcon',
|
121
|
+
CHANGE_ICON_COLOR: 'changeIconColor',
|
122
|
+
ADD_SHAPE: 'addShape',
|
123
|
+
CHANGE_SHAPE: 'changeShape',
|
124
|
+
ADD_TEXT: 'addText',
|
125
|
+
CHANGE_TEXT: 'changeText',
|
126
|
+
CHANGE_TEXT_STYLE: 'changeTextStyle',
|
127
|
+
ADD_IMAGE_OBJECT: 'addImageObject',
|
128
|
+
RESIZE_CANVAS_DIMENSION: 'resizeCanvasDimension',
|
129
|
+
SET_OBJECT_PROPERTIES: 'setObjectProperties',
|
130
|
+
SET_OBJECT_POSITION: 'setObjectPosition',
|
131
|
+
CHANGE_SELECTION: 'changeSelection',
|
132
|
+
RESIZE_IMAGE: 'resize',
|
133
|
+
};
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Event names
|
137
|
+
* @type {Object.<string, string>}
|
138
|
+
*/
|
139
|
+
export const eventNames = {
|
140
|
+
OBJECT_ACTIVATED: 'objectActivated',
|
141
|
+
OBJECT_MOVED: 'objectMoved',
|
142
|
+
OBJECT_SCALED: 'objectScaled',
|
143
|
+
OBJECT_CREATED: 'objectCreated',
|
144
|
+
OBJECT_ROTATED: 'objectRotated',
|
145
|
+
OBJECT_ADDED: 'objectAdded',
|
146
|
+
OBJECT_MODIFIED: 'objectModified',
|
147
|
+
TEXT_EDITING: 'textEditing',
|
148
|
+
TEXT_CHANGED: 'textChanged',
|
149
|
+
ICON_CREATE_RESIZE: 'iconCreateResize',
|
150
|
+
ICON_CREATE_END: 'iconCreateEnd',
|
151
|
+
ADD_TEXT: 'addText',
|
152
|
+
ADD_OBJECT: 'addObject',
|
153
|
+
ADD_OBJECT_AFTER: 'addObjectAfter',
|
154
|
+
MOUSE_DOWN: 'mousedown',
|
155
|
+
MOUSE_UP: 'mouseup',
|
156
|
+
MOUSE_MOVE: 'mousemove',
|
157
|
+
// UNDO/REDO Events
|
158
|
+
REDO_STACK_CHANGED: 'redoStackChanged',
|
159
|
+
UNDO_STACK_CHANGED: 'undoStackChanged',
|
160
|
+
SELECTION_CLEARED: 'selectionCleared',
|
161
|
+
SELECTION_CREATED: 'selectionCreated',
|
162
|
+
EXECUTE_COMMAND: 'executeCommand',
|
163
|
+
AFTER_UNDO: 'afterUndo',
|
164
|
+
AFTER_REDO: 'afterRedo',
|
165
|
+
ZOOM_CHANGED: 'zoomChanged',
|
166
|
+
HAND_STARTED: 'handStarted',
|
167
|
+
HAND_STOPPED: 'handStopped',
|
168
|
+
KEY_DOWN: 'keydown',
|
169
|
+
KEY_UP: 'keyup',
|
170
|
+
INPUT_BOX_EDITING_STARTED: 'inputBoxEditingStarted',
|
171
|
+
INPUT_BOX_EDITING_STOPPED: 'inputBoxEditingStopped',
|
172
|
+
FOCUS: 'focus',
|
173
|
+
BLUR: 'blur',
|
174
|
+
IMAGE_RESIZED: 'imageResized',
|
175
|
+
};
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Selector names
|
179
|
+
* @type {Object.<string, string>}
|
180
|
+
*/
|
181
|
+
export const selectorNames = {
|
182
|
+
COLOR_PICKER_INPUT_BOX: '.tui-colorpicker-palette-hex',
|
183
|
+
};
|
184
|
+
|
185
|
+
/**
|
186
|
+
* History names
|
187
|
+
* @type {Object.<string, string>}
|
188
|
+
*/
|
189
|
+
export const historyNames = {
|
190
|
+
LOAD_IMAGE: 'Load',
|
191
|
+
LOAD_MASK_IMAGE: 'Mask',
|
192
|
+
ADD_MASK_IMAGE: 'Mask',
|
193
|
+
ADD_IMAGE_OBJECT: 'Mask',
|
194
|
+
CROP: 'Crop',
|
195
|
+
RESIZE: 'Resize',
|
196
|
+
APPLY_FILTER: 'Filter',
|
197
|
+
REMOVE_FILTER: 'Filter',
|
198
|
+
CHANGE_SHAPE: 'Shape',
|
199
|
+
CHANGE_ICON_COLOR: 'Icon',
|
200
|
+
ADD_TEXT: 'Text',
|
201
|
+
CHANGE_TEXT_STYLE: 'Text',
|
202
|
+
REMOVE_OBJECT: 'Delete',
|
203
|
+
CLEAR_OBJECTS: 'Delete',
|
204
|
+
};
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Editor states
|
208
|
+
* @type {Object.<string, string>}
|
209
|
+
*/
|
210
|
+
export const drawingModes = keyMirror(
|
211
|
+
'NORMAL',
|
212
|
+
'CROPPER',
|
213
|
+
'FREE_DRAWING',
|
214
|
+
'LINE_DRAWING',
|
215
|
+
'TEXT',
|
216
|
+
'SHAPE',
|
217
|
+
'ICON',
|
218
|
+
'ZOOM',
|
219
|
+
'RESIZE'
|
220
|
+
);
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Menu names with drawing mode
|
224
|
+
* @type {Object.<string, string>}
|
225
|
+
*/
|
226
|
+
export const drawingMenuNames = {
|
227
|
+
TEXT: 'text',
|
228
|
+
CROP: 'crop',
|
229
|
+
RESIZE: 'resize',
|
230
|
+
SHAPE: 'shape',
|
231
|
+
ZOOM: 'zoom',
|
232
|
+
};
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Zoom modes
|
236
|
+
* @type {Object.<string, string>}
|
237
|
+
*/
|
238
|
+
export const zoomModes = {
|
239
|
+
DEFAULT: 'normal',
|
240
|
+
ZOOM: 'zoom',
|
241
|
+
HAND: 'hand',
|
242
|
+
};
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Shortcut key values
|
246
|
+
* @type {Object.<string, number>}
|
247
|
+
*/
|
248
|
+
export const keyCodes = {
|
249
|
+
Z: 90,
|
250
|
+
Y: 89,
|
251
|
+
C: 67,
|
252
|
+
V: 86,
|
253
|
+
SHIFT: 16,
|
254
|
+
BACKSPACE: 8,
|
255
|
+
DEL: 46,
|
256
|
+
ARROW_DOWN: 40,
|
257
|
+
ARROW_UP: 38,
|
258
|
+
SPACE: 32,
|
259
|
+
DIGIT_0: 48,
|
260
|
+
DIGIT_9: 57,
|
261
|
+
};
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Fabric object options
|
265
|
+
* @type {Object.<string, Object>}
|
266
|
+
*/
|
267
|
+
export const fObjectOptions = {
|
268
|
+
SELECTION_STYLE: {
|
269
|
+
borderColor: 'red',
|
270
|
+
cornerColor: 'green',
|
271
|
+
cornerSize: 10,
|
272
|
+
originX: 'center',
|
273
|
+
originY: 'center',
|
274
|
+
transparentCorners: false,
|
275
|
+
},
|
276
|
+
};
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Promise reject messages
|
280
|
+
* @type {Object.<string, string>}
|
281
|
+
*/
|
282
|
+
export const rejectMessages = {
|
283
|
+
addedObject: 'The object is already added.',
|
284
|
+
flip: 'The flipX and flipY setting values are not changed.',
|
285
|
+
invalidDrawingMode: 'This operation is not supported in the drawing mode.',
|
286
|
+
invalidParameters: 'Invalid parameters.',
|
287
|
+
isLock: 'The executing command state is locked.',
|
288
|
+
loadImage: 'The background image is empty.',
|
289
|
+
loadingImageFailed: 'Invalid image loaded.',
|
290
|
+
noActiveObject: 'There is no active object.',
|
291
|
+
noObject: 'The object is not in canvas.',
|
292
|
+
redo: 'The promise of redo command is reject.',
|
293
|
+
rotation: 'The current angle is same the old angle.',
|
294
|
+
undo: 'The promise of undo command is reject.',
|
295
|
+
unsupportedOperation: 'Unsupported operation.',
|
296
|
+
unsupportedType: 'Unsupported object type.',
|
297
|
+
};
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Default icon menu svg path
|
301
|
+
* @type {Object.<string, string>}
|
302
|
+
*/
|
303
|
+
export const defaultIconPath = {
|
304
|
+
'icon-arrow': 'M40 12V0l24 24-24 24V36H0V12h40z',
|
305
|
+
'icon-arrow-2': 'M49,32 H3 V22 h46 l-18,-18 h12 l23,23 L43,50 h-12 l18,-18 z ',
|
306
|
+
'icon-arrow-3':
|
307
|
+
'M43.349998,27 L17.354,53 H1.949999 l25.996,-26 L1.949999,1 h15.404 L43.349998,27 z ',
|
308
|
+
'icon-star':
|
309
|
+
'M35,54.557999 l-19.912001,10.468 l3.804,-22.172001 l-16.108,-15.7 l22.26,-3.236 L35,3.746 l9.956,20.172001 l22.26,3.236 l-16.108,15.7 l3.804,22.172001 z ',
|
310
|
+
'icon-star-2':
|
311
|
+
'M17,31.212 l-7.194,4.08 l-4.728,-6.83 l-8.234,0.524 l-1.328,-8.226 l-7.644,-3.14 l2.338,-7.992 l-5.54,-6.18 l5.54,-6.176 l-2.338,-7.994 l7.644,-3.138 l1.328,-8.226 l8.234,0.522 l4.728,-6.83 L17,-24.312 l7.194,-4.08 l4.728,6.83 l8.234,-0.522 l1.328,8.226 l7.644,3.14 l-2.338,7.992 l5.54,6.178 l-5.54,6.178 l2.338,7.992 l-7.644,3.14 l-1.328,8.226 l-8.234,-0.524 l-4.728,6.83 z ',
|
312
|
+
'icon-polygon': 'M3,31 L19,3 h32 l16,28 l-16,28 H19 z ',
|
313
|
+
'icon-location':
|
314
|
+
'M24 62C8 45.503 0 32.837 0 24 0 10.745 10.745 0 24 0s24 10.745 24 24c0 8.837-8 21.503-24 38zm0-28c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10z',
|
315
|
+
'icon-heart':
|
316
|
+
'M49.994999,91.349998 l-6.96,-6.333 C18.324001,62.606995 2.01,47.829002 2.01,29.690998 C2.01,14.912998 13.619999,3.299999 28.401001,3.299999 c8.349,0 16.362,5.859 21.594,12 c5.229,-6.141 13.242001,-12 21.591,-12 c14.778,0 26.390999,11.61 26.390999,26.390999 c0,18.138 -16.314001,32.916 -41.025002,55.374001 l-6.96,6.285 z ',
|
317
|
+
'icon-bubble':
|
318
|
+
'M44 48L34 58V48H12C5.373 48 0 42.627 0 36V12C0 5.373 5.373 0 12 0h40c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12h-8z',
|
319
|
+
};
|
320
|
+
|
321
|
+
export const defaultRotateRangeValues = {
|
322
|
+
realTimeEvent: true,
|
323
|
+
min: -360,
|
324
|
+
max: 360,
|
325
|
+
value: 0,
|
326
|
+
};
|
327
|
+
|
328
|
+
export const defaultDrawRangeValues = {
|
329
|
+
min: 5,
|
330
|
+
max: 30,
|
331
|
+
value: 12,
|
332
|
+
};
|
333
|
+
|
334
|
+
export const defaultShapeStrokeValues = {
|
335
|
+
realTimeEvent: true,
|
336
|
+
min: 2,
|
337
|
+
max: 300,
|
338
|
+
value: 3,
|
339
|
+
};
|
340
|
+
|
341
|
+
export const defaultTextRangeValues = {
|
342
|
+
realTimeEvent: true,
|
343
|
+
min: 10,
|
344
|
+
max: 100,
|
345
|
+
value: 50,
|
346
|
+
};
|
347
|
+
|
348
|
+
export const defaultFilterRangeValues = {
|
349
|
+
tintOpacityRange: {
|
350
|
+
realTimeEvent: true,
|
351
|
+
min: 0,
|
352
|
+
max: 1,
|
353
|
+
value: 0.7,
|
354
|
+
useDecimal: true,
|
355
|
+
},
|
356
|
+
removewhiteDistanceRange: {
|
357
|
+
realTimeEvent: true,
|
358
|
+
min: 0,
|
359
|
+
max: 1,
|
360
|
+
value: 0.2,
|
361
|
+
useDecimal: true,
|
362
|
+
},
|
363
|
+
brightnessRange: {
|
364
|
+
realTimeEvent: true,
|
365
|
+
min: -1,
|
366
|
+
max: 1,
|
367
|
+
value: 0,
|
368
|
+
useDecimal: true,
|
369
|
+
},
|
370
|
+
noiseRange: {
|
371
|
+
realTimeEvent: true,
|
372
|
+
min: 0,
|
373
|
+
max: 1000,
|
374
|
+
value: 100,
|
375
|
+
},
|
376
|
+
pixelateRange: {
|
377
|
+
realTimeEvent: true,
|
378
|
+
min: 2,
|
379
|
+
max: 20,
|
380
|
+
value: 4,
|
381
|
+
},
|
382
|
+
colorfilterThresholdRange: {
|
383
|
+
realTimeEvent: true,
|
384
|
+
min: 0,
|
385
|
+
max: 1,
|
386
|
+
value: 0.2,
|
387
|
+
useDecimal: true,
|
388
|
+
},
|
389
|
+
blurFilterRange: {
|
390
|
+
value: 0.1,
|
391
|
+
},
|
392
|
+
};
|
393
|
+
|
394
|
+
export const emptyCropRectValues = {
|
395
|
+
LEFT: 0,
|
396
|
+
TOP: 0,
|
397
|
+
WIDTH: 0.5,
|
398
|
+
HEIGHT: 0.5,
|
399
|
+
};
|
400
|
+
|
401
|
+
export const defaultResizePixelValues = {
|
402
|
+
realTimeEvent: true,
|
403
|
+
min: 32,
|
404
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* CropperDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class CropperDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.CROPPER);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const cropper = graphics.getComponent(components.CROPPER);
|
21
|
+
cropper.start();
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* stop this drawing mode
|
26
|
+
* @param {Graphics} graphics - Graphics instance
|
27
|
+
* @override
|
28
|
+
*/
|
29
|
+
end(graphics) {
|
30
|
+
const cropper = graphics.getComponent(components.CROPPER);
|
31
|
+
cropper.end();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export default CropperDrawingMode;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* FreeDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class FreeDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.FREE_DRAWING);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @param {{width: ?number, color: ?string}} [options] - Brush width & color
|
18
|
+
* @override
|
19
|
+
*/
|
20
|
+
start(graphics, options) {
|
21
|
+
const freeDrawing = graphics.getComponent(components.FREE_DRAWING);
|
22
|
+
freeDrawing.start(options);
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* stop this drawing mode
|
27
|
+
* @param {Graphics} graphics - Graphics instance
|
28
|
+
* @override
|
29
|
+
*/
|
30
|
+
end(graphics) {
|
31
|
+
const freeDrawing = graphics.getComponent(components.FREE_DRAWING);
|
32
|
+
freeDrawing.end();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
export default FreeDrawingMode;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* IconDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class IconDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.ICON);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const icon = graphics.getComponent(components.ICON);
|
21
|
+
icon.start();
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* stop this drawing mode
|
26
|
+
* @param {Graphics} graphics - Graphics instance
|
27
|
+
* @override
|
28
|
+
*/
|
29
|
+
end(graphics) {
|
30
|
+
const icon = graphics.getComponent(components.ICON);
|
31
|
+
icon.end();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export default IconDrawingMode;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* LineDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class LineDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.LINE_DRAWING);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @param {{width: ?number, color: ?string}} [options] - Brush width & color
|
18
|
+
* @override
|
19
|
+
*/
|
20
|
+
start(graphics, options) {
|
21
|
+
const lineDrawing = graphics.getComponent(components.LINE);
|
22
|
+
lineDrawing.start(options);
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* stop this drawing mode
|
27
|
+
* @param {Graphics} graphics - Graphics instance
|
28
|
+
* @override
|
29
|
+
*/
|
30
|
+
end(graphics) {
|
31
|
+
const lineDrawing = graphics.getComponent(components.LINE);
|
32
|
+
lineDrawing.end();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
export default LineDrawingMode;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* ResizeDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class ResizeDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.RESIZE);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const resize = graphics.getComponent(components.RESIZE);
|
21
|
+
resize.start();
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* stop this drawing mode
|
26
|
+
* @param {Graphics} graphics - Graphics instance
|
27
|
+
* @override
|
28
|
+
*/
|
29
|
+
end(graphics) {
|
30
|
+
const resize = graphics.getComponent(components.RESIZE);
|
31
|
+
resize.end();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export default ResizeDrawingMode;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* ShapeDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class ShapeDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.SHAPE);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const shape = graphics.getComponent(components.SHAPE);
|
21
|
+
shape.start();
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* stop this drawing mode
|
26
|
+
* @param {Graphics} graphics - Graphics instance
|
27
|
+
* @override
|
28
|
+
*/
|
29
|
+
end(graphics) {
|
30
|
+
const shape = graphics.getComponent(components.SHAPE);
|
31
|
+
shape.end();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export default ShapeDrawingMode;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* TextDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class TextDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.TEXT);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const text = graphics.getComponent(components.TEXT);
|
21
|
+
text.start();
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* stop this drawing mode
|
26
|
+
* @param {Graphics} graphics - Graphics instance
|
27
|
+
* @override
|
28
|
+
*/
|
29
|
+
end(graphics) {
|
30
|
+
const text = graphics.getComponent(components.TEXT);
|
31
|
+
text.end();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export default TextDrawingMode;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import DrawingMode from '@/interface/drawingMode';
|
2
|
+
import { drawingModes, componentNames as components } from '@/consts';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* ZoomDrawingMode class
|
6
|
+
* @class
|
7
|
+
* @ignore
|
8
|
+
*/
|
9
|
+
class ZoomDrawingMode extends DrawingMode {
|
10
|
+
constructor() {
|
11
|
+
super(drawingModes.ZOOM);
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* start this drawing mode
|
16
|
+
* @param {Graphics} graphics - Graphics instance
|
17
|
+
* @override
|
18
|
+
*/
|
19
|
+
start(graphics) {
|
20
|
+
const zoom = graphics.getComponent(components.ZOOM);
|
21
|
+
|
22
|
+
zoom.start();
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* stop this drawing mode
|
27
|
+
* @param {Graphics} graphics - Graphics instance
|
28
|
+
* @override
|
29
|
+
*/
|
30
|
+
end(graphics) {
|
31
|
+
const zoom = graphics.getComponent(components.ZOOM);
|
32
|
+
|
33
|
+
zoom.end();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
export default ZoomDrawingMode;
|