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
@@ -0,0 +1,108 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li class="tie-icon-add-button">
|
10
|
+
<div class="tui-image-editor-button" data-icontype="icon-arrow">
|
11
|
+
<div>
|
12
|
+
${makeSvgIcon(['normal', 'active'], 'icon-arrow', true)}
|
13
|
+
</div>
|
14
|
+
<label>
|
15
|
+
${locale.localize('Arrow')}
|
16
|
+
</label>
|
17
|
+
</div>
|
18
|
+
<div class="tui-image-editor-button" data-icontype="icon-arrow-2">
|
19
|
+
<div>
|
20
|
+
${makeSvgIcon(['normal', 'active'], 'icon-arrow-2', true)}
|
21
|
+
</div>
|
22
|
+
<label>
|
23
|
+
${locale.localize('Arrow-2')}
|
24
|
+
</label>
|
25
|
+
</div>
|
26
|
+
<div class="tui-image-editor-button" data-icontype="icon-arrow-3">
|
27
|
+
<div>
|
28
|
+
${makeSvgIcon(['normal', 'active'], 'icon-arrow-3', true)}
|
29
|
+
</div>
|
30
|
+
<label>
|
31
|
+
${locale.localize('Arrow-3')}
|
32
|
+
</label>
|
33
|
+
</div>
|
34
|
+
<div class="tui-image-editor-button" data-icontype="icon-star">
|
35
|
+
<div>
|
36
|
+
${makeSvgIcon(['normal', 'active'], 'icon-star', true)}
|
37
|
+
</div>
|
38
|
+
<label>
|
39
|
+
${locale.localize('Star-1')}
|
40
|
+
</label>
|
41
|
+
</div>
|
42
|
+
<div class="tui-image-editor-button" data-icontype="icon-star-2">
|
43
|
+
<div>
|
44
|
+
${makeSvgIcon(['normal', 'active'], 'icon-star-2', true)}
|
45
|
+
</div>
|
46
|
+
<label>
|
47
|
+
${locale.localize('Star-2')}
|
48
|
+
</label>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="tui-image-editor-button" data-icontype="icon-polygon">
|
52
|
+
<div>
|
53
|
+
${makeSvgIcon(['normal', 'active'], 'icon-polygon', true)}
|
54
|
+
</div>
|
55
|
+
<label>
|
56
|
+
${locale.localize('Polygon')}
|
57
|
+
</label>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="tui-image-editor-button" data-icontype="icon-location">
|
61
|
+
<div>
|
62
|
+
${makeSvgIcon(['normal', 'active'], 'icon-location', true)}
|
63
|
+
</div>
|
64
|
+
<label>
|
65
|
+
${locale.localize('Location')}
|
66
|
+
</label>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div class="tui-image-editor-button" data-icontype="icon-heart">
|
70
|
+
<div>
|
71
|
+
${makeSvgIcon(['normal', 'active'], 'icon-heart', true)}
|
72
|
+
</div>
|
73
|
+
<label>
|
74
|
+
${locale.localize('Heart')}
|
75
|
+
</label>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<div class="tui-image-editor-button" data-icontype="icon-bubble">
|
79
|
+
<div>
|
80
|
+
${makeSvgIcon(['normal', 'active'], 'icon-bubble', true)}
|
81
|
+
</div>
|
82
|
+
<label>
|
83
|
+
${locale.localize('Bubble')}
|
84
|
+
</label>
|
85
|
+
</div>
|
86
|
+
</li>
|
87
|
+
<li class="tui-image-editor-partition">
|
88
|
+
<div></div>
|
89
|
+
</li>
|
90
|
+
<li class="tie-icon-add-button">
|
91
|
+
<div class="tui-image-editor-button" style="margin:0">
|
92
|
+
<div>
|
93
|
+
<input type="file" accept="image/*" class="tie-icon-image-file">
|
94
|
+
${makeSvgIcon(['normal', 'active'], 'icon-load', true)}
|
95
|
+
</div>
|
96
|
+
<label>
|
97
|
+
${locale.localize('Custom icon')}
|
98
|
+
</label>
|
99
|
+
</div>
|
100
|
+
</li>
|
101
|
+
<li class="tui-image-editor-partition">
|
102
|
+
<div></div>
|
103
|
+
</li>
|
104
|
+
<li>
|
105
|
+
<div class="tie-icon-color" title="${locale.localize('Color')}"></div>
|
106
|
+
</li>
|
107
|
+
</ul>
|
108
|
+
`;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li>
|
10
|
+
<div class="tui-image-editor-button">
|
11
|
+
<div>
|
12
|
+
<input type="file" accept="image/*" class="tie-mask-image-file">
|
13
|
+
${makeSvgIcon(['normal', 'active'], 'mask-load', true)}
|
14
|
+
</div>
|
15
|
+
<label> ${locale.localize('Load Mask Image')} </label>
|
16
|
+
</div>
|
17
|
+
</li>
|
18
|
+
<li class="tui-image-editor-partition only-left-right">
|
19
|
+
<div></div>
|
20
|
+
</li>
|
21
|
+
<li class="tie-mask-apply tui-image-editor-newline apply" style="margin-top: 22px;margin-bottom: 5px">
|
22
|
+
<div class="tui-image-editor-button apply">
|
23
|
+
${makeSvgIcon(['normal', 'active'], 'apply')}
|
24
|
+
<label>
|
25
|
+
${locale.localize('Apply')}
|
26
|
+
</label>
|
27
|
+
</div>
|
28
|
+
</li>
|
29
|
+
</ul>
|
30
|
+
`;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li class="tui-image-editor-submenu-align">
|
10
|
+
<div class="tui-image-editor-range-wrap tui-image-editor-newline">
|
11
|
+
<label class="range">${locale.localize('Width')} </label>
|
12
|
+
<div class="tie-width-range"></div>
|
13
|
+
<input class="tie-width-range-value tui-image-editor-range-value" value="0" /> <label>px</label>
|
14
|
+
<div class="tui-image-editor-partition tui-image-editor-newline"></div>
|
15
|
+
<label class="range">${locale.localize('Height')}</label>
|
16
|
+
<div class="tie-height-range"></div>
|
17
|
+
<input class="tie-height-range-value tui-image-editor-range-value" value="0" /> <label>px</label>
|
18
|
+
</div>
|
19
|
+
</li>
|
20
|
+
<li class="tui-image-editor-partition tui-image-editor-newline"></li>
|
21
|
+
<li class="tui-image-editor-partition only-left-right">
|
22
|
+
<div></div>
|
23
|
+
</li>
|
24
|
+
<li class="tui-image-editor-submenu-align">
|
25
|
+
<div class="tui-image-editor-checkbox-wrap">
|
26
|
+
<div class="tui-image-editor-checkbox">
|
27
|
+
<label>
|
28
|
+
<input type="checkbox" class="tie-lock-aspect-ratio">
|
29
|
+
<span>${locale.localize('Lock Aspect Ratio')}</span>
|
30
|
+
</label>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</li>
|
34
|
+
<li class="tui-image-editor-partition tui-image-editor-newline"></li>
|
35
|
+
<li class="tui-image-editor-partition only-left-right">
|
36
|
+
<div></div>
|
37
|
+
</li>
|
38
|
+
<li class="tui-image-editor-partition tui-image-editor-newline"></li>
|
39
|
+
<li class="tie-resize-button action">
|
40
|
+
<div class="tui-image-editor-button apply">
|
41
|
+
${makeSvgIcon(['normal', 'active'], 'apply')}
|
42
|
+
<label>
|
43
|
+
${locale.localize('Apply')}
|
44
|
+
</label>
|
45
|
+
</div>
|
46
|
+
<div class="tui-image-editor-button cancel">
|
47
|
+
${makeSvgIcon(['normal', 'active'], 'cancel')}
|
48
|
+
<label>
|
49
|
+
${locale.localize('Cancel')}
|
50
|
+
</label>
|
51
|
+
</div>
|
52
|
+
</li>
|
53
|
+
</ul>
|
54
|
+
`;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li class="tie-rotate-button">
|
10
|
+
<div class="tui-image-editor-button clockwise">
|
11
|
+
<div>
|
12
|
+
${makeSvgIcon(['normal', 'active'], 'rotate-clockwise', true)}
|
13
|
+
</div>
|
14
|
+
<label> 30 </label>
|
15
|
+
</div>
|
16
|
+
<div class="tui-image-editor-button counterclockwise">
|
17
|
+
<div>
|
18
|
+
${makeSvgIcon(['normal', 'active'], 'rotate-counterclockwise', true)}
|
19
|
+
</div>
|
20
|
+
<label> -30 </label>
|
21
|
+
</div>
|
22
|
+
</li>
|
23
|
+
<li class="tui-image-editor-partition only-left-right">
|
24
|
+
<div></div>
|
25
|
+
</li>
|
26
|
+
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
|
27
|
+
<label class="range">${locale.localize('Range')}</label>
|
28
|
+
<div class="tie-rotate-range"></div>
|
29
|
+
<input class="tie-rotate-range-value tui-image-editor-range-value" value="0" />
|
30
|
+
</li>
|
31
|
+
</ul>
|
32
|
+
`;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li class="tie-shape-button">
|
10
|
+
<div class="tui-image-editor-button rect">
|
11
|
+
<div>
|
12
|
+
${makeSvgIcon(['normal', 'active'], 'shape-rectangle', true)}
|
13
|
+
</div>
|
14
|
+
<label> ${locale.localize('Rectangle')} </label>
|
15
|
+
</div>
|
16
|
+
<div class="tui-image-editor-button circle">
|
17
|
+
<div>
|
18
|
+
${makeSvgIcon(['normal', 'active'], 'shape-circle', true)}
|
19
|
+
</div>
|
20
|
+
<label> ${locale.localize('Circle')} </label>
|
21
|
+
</div>
|
22
|
+
<div class="tui-image-editor-button triangle">
|
23
|
+
<div>
|
24
|
+
${makeSvgIcon(['normal', 'active'], 'shape-triangle', true)}
|
25
|
+
</div>
|
26
|
+
<label> ${locale.localize('Triangle')} </label>
|
27
|
+
</div>
|
28
|
+
</li>
|
29
|
+
<li class="tui-image-editor-partition">
|
30
|
+
<div></div>
|
31
|
+
</li>
|
32
|
+
<li class="tie-shape-color-button">
|
33
|
+
<div class="tie-color-fill" title="${locale.localize('Fill')}"></div>
|
34
|
+
<div class="tie-color-stroke" title="${locale.localize('Stroke')}"></div>
|
35
|
+
</li>
|
36
|
+
<li class="tui-image-editor-partition only-left-right">
|
37
|
+
<div></div>
|
38
|
+
</li>
|
39
|
+
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
|
40
|
+
<label class="range">${locale.localize('Stroke')}</label>
|
41
|
+
<div class="tie-stroke-range"></div>
|
42
|
+
<input class="tie-stroke-range-value tui-image-editor-range-value" value="0" />
|
43
|
+
</li>
|
44
|
+
</ul>
|
45
|
+
`;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tui-image-editor-submenu-item">
|
9
|
+
<li class="tie-text-effect-button">
|
10
|
+
<div class="tui-image-editor-button bold">
|
11
|
+
<div>
|
12
|
+
${makeSvgIcon(['normal', 'active'], 'text-bold', true)}
|
13
|
+
</div>
|
14
|
+
<label> ${locale.localize('Bold')} </label>
|
15
|
+
</div>
|
16
|
+
<div class="tui-image-editor-button italic">
|
17
|
+
<div>
|
18
|
+
${makeSvgIcon(['normal', 'active'], 'text-italic', true)}
|
19
|
+
</div>
|
20
|
+
<label> ${locale.localize('Italic')} </label>
|
21
|
+
</div>
|
22
|
+
<div class="tui-image-editor-button underline">
|
23
|
+
<div>
|
24
|
+
${makeSvgIcon(['normal', 'active'], 'text-underline', true)}
|
25
|
+
</div>
|
26
|
+
<label> ${locale.localize('Underline')} </label>
|
27
|
+
</div>
|
28
|
+
</li>
|
29
|
+
<li class="tui-image-editor-partition">
|
30
|
+
<div></div>
|
31
|
+
</li>
|
32
|
+
<li class="tie-text-align-button">
|
33
|
+
<div class="tui-image-editor-button left">
|
34
|
+
<div>
|
35
|
+
${makeSvgIcon(['normal', 'active'], 'text-align-left', true)}
|
36
|
+
</div>
|
37
|
+
<label> ${locale.localize('Left')} </label>
|
38
|
+
</div>
|
39
|
+
<div class="tui-image-editor-button center">
|
40
|
+
<div>
|
41
|
+
${makeSvgIcon(['normal', 'active'], 'text-align-center', true)}
|
42
|
+
</div>
|
43
|
+
<label> ${locale.localize('Center')} </label>
|
44
|
+
</div>
|
45
|
+
<div class="tui-image-editor-button right">
|
46
|
+
<div>
|
47
|
+
${makeSvgIcon(['normal', 'active'], 'text-align-right', true)}
|
48
|
+
</div>
|
49
|
+
<label> ${locale.localize('Right')} </label>
|
50
|
+
</div>
|
51
|
+
</li>
|
52
|
+
<li class="tui-image-editor-partition">
|
53
|
+
<div></div>
|
54
|
+
</li>
|
55
|
+
<li>
|
56
|
+
<div class="tie-text-color" title="${locale.localize('Color')}"></div>
|
57
|
+
</li>
|
58
|
+
<li class="tui-image-editor-partition only-left-right">
|
59
|
+
<div></div>
|
60
|
+
</li>
|
61
|
+
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
|
62
|
+
<label class="range">${locale.localize('Text size')}</label>
|
63
|
+
<div class="tie-text-range"></div>
|
64
|
+
<input class="tie-text-range-value tui-image-editor-range-value" value="0" />
|
65
|
+
</li>
|
66
|
+
</ul>
|
67
|
+
`;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/**
|
2
|
+
* @param {Object} submenuInfo - submenu info for make template
|
3
|
+
* @param {Locale} locale - Translate text
|
4
|
+
* @param {Function} makeSvgIcon - svg icon generator
|
5
|
+
* @returns {string}
|
6
|
+
*/
|
7
|
+
export default ({ locale, makeSvgIcon }) => `
|
8
|
+
<ul class="tie-zoom-button tui-image-editor-submenu-item">
|
9
|
+
<li>
|
10
|
+
<div class="tui-image-editor-button zoomIn">
|
11
|
+
<div>
|
12
|
+
${makeSvgIcon(['normal', 'active'], 'zoom-in', true)}
|
13
|
+
</div>
|
14
|
+
<label>
|
15
|
+
${locale.localize('Zoom In')}
|
16
|
+
</label>
|
17
|
+
</div>
|
18
|
+
<div class="tui-image-editor-button zoomOut">
|
19
|
+
<div>
|
20
|
+
${makeSvgIcon(['normal', 'active'], 'zoom-out', true)}
|
21
|
+
</div>
|
22
|
+
<label>
|
23
|
+
${locale.localize('Zoom Out')}
|
24
|
+
</label>
|
25
|
+
</div>
|
26
|
+
</li>
|
27
|
+
<li class="tui-image-editor-partition">
|
28
|
+
<div></div>
|
29
|
+
</li>
|
30
|
+
<li>
|
31
|
+
<div class="tui-image-editor-button hand">
|
32
|
+
<div>
|
33
|
+
${makeSvgIcon(['normal', 'active'], 'zoom-hand', true)}
|
34
|
+
</div>
|
35
|
+
<label>
|
36
|
+
${locale.localize('Hand')}
|
37
|
+
</label>
|
38
|
+
</div>
|
39
|
+
</li>
|
40
|
+
</ul>
|
41
|
+
`;
|
@@ -0,0 +1,279 @@
|
|
1
|
+
import Range from '@/ui/tools/range';
|
2
|
+
import Colorpicker from '@/ui/tools/colorpicker';
|
3
|
+
import Submenu from '@/ui/submenuBase';
|
4
|
+
import templateHtml from '@/ui/template/submenu/text';
|
5
|
+
import { assignmentForDestroy } from '@/util';
|
6
|
+
import { defaultTextRangeValues, eventNames, selectorNames } from '@/consts';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Crop ui class
|
10
|
+
* @class
|
11
|
+
* @ignore
|
12
|
+
*/
|
13
|
+
class Text extends Submenu {
|
14
|
+
constructor(subMenuElement, { locale, makeSvgIcon, menuBarPosition, usageStatistics }) {
|
15
|
+
super(subMenuElement, {
|
16
|
+
locale,
|
17
|
+
name: 'text',
|
18
|
+
makeSvgIcon,
|
19
|
+
menuBarPosition,
|
20
|
+
templateHtml,
|
21
|
+
usageStatistics,
|
22
|
+
});
|
23
|
+
this.effect = {
|
24
|
+
bold: false,
|
25
|
+
italic: false,
|
26
|
+
underline: false,
|
27
|
+
};
|
28
|
+
this.align = 'tie-text-align-left';
|
29
|
+
this._els = {
|
30
|
+
textEffectButton: this.selector('.tie-text-effect-button'),
|
31
|
+
textAlignButton: this.selector('.tie-text-align-button'),
|
32
|
+
textColorpicker: new Colorpicker(this.selector('.tie-text-color'), {
|
33
|
+
defaultColor: '#ffbb3b',
|
34
|
+
toggleDirection: this.toggleDirection,
|
35
|
+
usageStatistics: this.usageStatistics,
|
36
|
+
}),
|
37
|
+
textRange: new Range(
|
38
|
+
{
|
39
|
+
slider: this.selector('.tie-text-range'),
|
40
|
+
input: this.selector('.tie-text-range-value'),
|
41
|
+
},
|
42
|
+
defaultTextRangeValues
|
43
|
+
),
|
44
|
+
};
|
45
|
+
|
46
|
+
this.colorPickerInputBox = this._els.textColorpicker.colorpickerElement.querySelector(
|
47
|
+
selectorNames.COLOR_PICKER_INPUT_BOX
|
48
|
+
);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Destroys the instance.
|
53
|
+
*/
|
54
|
+
destroy() {
|
55
|
+
this._removeEvent();
|
56
|
+
this._els.textColorpicker.destroy();
|
57
|
+
this._els.textRange.destroy();
|
58
|
+
|
59
|
+
assignmentForDestroy(this);
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Add event for text
|
64
|
+
* @param {Object} actions - actions for text
|
65
|
+
* @param {Function} actions.changeTextStyle - change text style
|
66
|
+
*/
|
67
|
+
addEvent(actions) {
|
68
|
+
const setTextEffect = this._setTextEffectHandler.bind(this);
|
69
|
+
const setTextAlign = this._setTextAlignHandler.bind(this);
|
70
|
+
|
71
|
+
this.eventHandler = {
|
72
|
+
setTextEffect,
|
73
|
+
setTextAlign,
|
74
|
+
};
|
75
|
+
|
76
|
+
this.actions = actions;
|
77
|
+
this._els.textEffectButton.addEventListener('click', setTextEffect);
|
78
|
+
this._els.textAlignButton.addEventListener('click', setTextAlign);
|
79
|
+
this._els.textRange.on('change', this._changeTextRnageHandler.bind(this));
|
80
|
+
this._els.textColorpicker.on('change', this._changeColorHandler.bind(this));
|
81
|
+
|
82
|
+
this.colorPickerInputBox.addEventListener(
|
83
|
+
eventNames.FOCUS,
|
84
|
+
this._onStartEditingInputBox.bind(this)
|
85
|
+
);
|
86
|
+
this.colorPickerInputBox.addEventListener(
|
87
|
+
eventNames.BLUR,
|
88
|
+
this._onStopEditingInputBox.bind(this)
|
89
|
+
);
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Remove event
|
94
|
+
* @private
|
95
|
+
*/
|
96
|
+
_removeEvent() {
|
97
|
+
const { setTextEffect, setTextAlign } = this.eventHandler;
|
98
|
+
|
99
|
+
this._els.textEffectButton.removeEventListener('click', setTextEffect);
|
100
|
+
this._els.textAlignButton.removeEventListener('click', setTextAlign);
|
101
|
+
this._els.textRange.off();
|
102
|
+
this._els.textColorpicker.off();
|
103
|
+
|
104
|
+
this.colorPickerInputBox.removeEventListener(
|
105
|
+
eventNames.FOCUS,
|
106
|
+
this._onStartEditingInputBox.bind(this)
|
107
|
+
);
|
108
|
+
this.colorPickerInputBox.removeEventListener(
|
109
|
+
eventNames.BLUR,
|
110
|
+
this._onStopEditingInputBox.bind(this)
|
111
|
+
);
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Returns the menu to its default state.
|
116
|
+
*/
|
117
|
+
changeStandbyMode() {
|
118
|
+
this.actions.stopDrawingMode();
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Executed when the menu starts.
|
123
|
+
*/
|
124
|
+
changeStartMode() {
|
125
|
+
this.actions.modeChange('text');
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Get text color
|
130
|
+
* @returns {string} - text color
|
131
|
+
*/
|
132
|
+
get textColor() {
|
133
|
+
return this._els.textColorpicker.color;
|
134
|
+
}
|
135
|
+
|
136
|
+
set textColor(color) {
|
137
|
+
this._els.textColorpicker.color = color;
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Get text size
|
142
|
+
* @returns {string} - text size
|
143
|
+
*/
|
144
|
+
get fontSize() {
|
145
|
+
return this._els.textRange.value;
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Set text size
|
150
|
+
* @param {Number} value - text size
|
151
|
+
*/
|
152
|
+
set fontSize(value) {
|
153
|
+
this._els.textRange.value = value;
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* get font style
|
158
|
+
* @returns {string} - font style
|
159
|
+
*/
|
160
|
+
get fontStyle() {
|
161
|
+
return this.effect.italic ? 'italic' : 'normal';
|
162
|
+
}
|
163
|
+
|
164
|
+
/**
|
165
|
+
* get font weight
|
166
|
+
* @returns {string} - font weight
|
167
|
+
*/
|
168
|
+
get fontWeight() {
|
169
|
+
return this.effect.bold ? 'bold' : 'normal';
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* get text underline text underline
|
174
|
+
* @returns {boolean} - true or false
|
175
|
+
*/
|
176
|
+
get underline() {
|
177
|
+
return this.effect.underline;
|
178
|
+
}
|
179
|
+
|
180
|
+
setTextStyleStateOnAction(textStyle = {}) {
|
181
|
+
const { fill, fontSize, fontStyle, fontWeight, textDecoration, textAlign } = textStyle;
|
182
|
+
|
183
|
+
this.textColor = fill;
|
184
|
+
this.fontSize = fontSize;
|
185
|
+
this.setEffectState('italic', fontStyle);
|
186
|
+
this.setEffectState('bold', fontWeight);
|
187
|
+
this.setEffectState('underline', textDecoration);
|
188
|
+
this.setAlignState(`tie-text-align-${textAlign}`);
|
189
|
+
}
|
190
|
+
|
191
|
+
setEffectState(effectName, value) {
|
192
|
+
const effectValue = value === 'italic' || value === 'bold' || value === 'underline';
|
193
|
+
const button = this._els.textEffectButton.querySelector(
|
194
|
+
`.tui-image-editor-button.${effectName}`
|
195
|
+
);
|
196
|
+
|
197
|
+
this.effect[effectName] = effectValue;
|
198
|
+
|
199
|
+
button.classList[effectValue ? 'add' : 'remove']('active');
|
200
|
+
}
|
201
|
+
|
202
|
+
setAlignState(value) {
|
203
|
+
const button = this._els.textAlignButton;
|
204
|
+
button.classList.remove(this.align);
|
205
|
+
button.classList.add(value);
|
206
|
+
this.align = value;
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* text effect set handler
|
211
|
+
* @param {object} event - add button event object
|
212
|
+
* @private
|
213
|
+
*/
|
214
|
+
_setTextEffectHandler(event) {
|
215
|
+
const button = event.target.closest('.tui-image-editor-button');
|
216
|
+
if (button) {
|
217
|
+
const [styleType] = button.className.match(/(bold|italic|underline)/);
|
218
|
+
const styleObj = {
|
219
|
+
bold: { fontWeight: 'bold' },
|
220
|
+
italic: { fontStyle: 'italic' },
|
221
|
+
underline: { textDecoration: 'underline' },
|
222
|
+
}[styleType];
|
223
|
+
|
224
|
+
this.effect[styleType] = !this.effect[styleType];
|
225
|
+
button.classList.toggle('active');
|
226
|
+
this.actions.changeTextStyle(styleObj);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
/**
|
231
|
+
* text effect set handler
|
232
|
+
* @param {object} event - add button event object
|
233
|
+
* @private
|
234
|
+
*/
|
235
|
+
_setTextAlignHandler(event) {
|
236
|
+
const button = event.target.closest('.tui-image-editor-button');
|
237
|
+
if (button) {
|
238
|
+
const styleType = this.getButtonType(button, ['left', 'center', 'right']);
|
239
|
+
const styleTypeAlias = `tie-text-align-${styleType}`;
|
240
|
+
|
241
|
+
event.currentTarget.classList.remove(this.align);
|
242
|
+
if (this.align !== styleTypeAlias) {
|
243
|
+
event.currentTarget.classList.add(styleTypeAlias);
|
244
|
+
}
|
245
|
+
this.actions.changeTextStyle({ textAlign: styleType });
|
246
|
+
|
247
|
+
this.align = styleTypeAlias;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
/**
|
252
|
+
* text align set handler
|
253
|
+
* @param {number} value - range value
|
254
|
+
* @param {boolean} isLast - Is last change
|
255
|
+
* @private
|
256
|
+
*/
|
257
|
+
_changeTextRnageHandler(value, isLast) {
|
258
|
+
this.actions.changeTextStyle(
|
259
|
+
{
|
260
|
+
fontSize: value,
|
261
|
+
},
|
262
|
+
!isLast
|
263
|
+
);
|
264
|
+
}
|
265
|
+
|
266
|
+
/**
|
267
|
+
* change color handler
|
268
|
+
* @param {string} color - change color string
|
269
|
+
* @private
|
270
|
+
*/
|
271
|
+
_changeColorHandler(color) {
|
272
|
+
color = color || 'transparent';
|
273
|
+
this.actions.changeTextStyle({
|
274
|
+
fill: color,
|
275
|
+
});
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
export default Text;
|