cd-aichat 1.0.0
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 +188 -0
- package/dist/ailogo.png +0 -0
- package/dist/cd-aichat.css +1 -0
- package/dist/cd-aichat.es.js +32223 -0
- package/dist/cd-aichat.umd.js +279 -0
- package/dist/index.css +1 -0
- package/package.json +61 -0
- package/src/ailogo.png +0 -0
- package/src/components/AiChat.test.js +538 -0
- package/src/components/AiChat.vue +2206 -0
- package/src/components/AiChatWidget.test.js +312 -0
- package/src/components/AiChatWidget.vue +963 -0
- package/src/components/BurnAfterReadDialog.test.js +121 -0
- package/src/components/BurnAfterReadDialog.vue +511 -0
- package/src/components/BurnAfterReadMessage.test.js +188 -0
- package/src/components/BurnAfterReadMessage.vue +193 -0
- package/src/components/BurnIndicator.test.js +101 -0
- package/src/components/BurnIndicator.vue +164 -0
- package/src/components/ChatWindow.vue +0 -0
- package/src/components/MentionList.vue +163 -0
- package/src/components/ResourceList.vue +194 -0
- package/src/components/RichTextEditor.vue +437 -0
- package/src/components/ScheduledSendDialog.vue +476 -0
- package/src/components/ScreenshotOverlay.vue +78 -0
- package/src/components/SendButtonGroup.test.js +174 -0
- package/src/components/SendButtonGroup.vue +166 -0
- package/src/components/UserDrawer.vue +0 -0
- package/src/components/screenshot/ScreenshotsBackground/getBoundsByPoints.ts +41 -0
- package/src/components/screenshot/ScreenshotsBackground/index.scss +27 -0
- package/src/components/screenshot/ScreenshotsBackground/index.tsx +145 -0
- package/src/components/screenshot/ScreenshotsButton/index.scss +29 -0
- package/src/components/screenshot/ScreenshotsButton/index.tsx +58 -0
- package/src/components/screenshot/ScreenshotsCanvas/getBoundsByPoints.ts +55 -0
- package/src/components/screenshot/ScreenshotsCanvas/getPoints.ts +60 -0
- package/src/components/screenshot/ScreenshotsCanvas/index.scss +84 -0
- package/src/components/screenshot/ScreenshotsCanvas/index.tsx +277 -0
- package/src/components/screenshot/ScreenshotsCanvas/isPointInDraw.ts +35 -0
- package/src/components/screenshot/ScreenshotsColor/index.scss +45 -0
- package/src/components/screenshot/ScreenshotsColor/index.tsx +39 -0
- package/src/components/screenshot/ScreenshotsContext.ts +56 -0
- package/src/components/screenshot/ScreenshotsMagnifier/index.scss +61 -0
- package/src/components/screenshot/ScreenshotsMagnifier/index.tsx +126 -0
- package/src/components/screenshot/ScreenshotsOperations/index.scss +25 -0
- package/src/components/screenshot/ScreenshotsOperations/index.tsx +118 -0
- package/src/components/screenshot/ScreenshotsOption/index.scss +50 -0
- package/src/components/screenshot/ScreenshotsOption/index.tsx +150 -0
- package/src/components/screenshot/ScreenshotsSize/index.scss +28 -0
- package/src/components/screenshot/ScreenshotsSize/index.tsx +41 -0
- package/src/components/screenshot/ScreenshotsSizeColor/index.scss +8 -0
- package/src/components/screenshot/ScreenshotsSizeColor/index.tsx +25 -0
- package/src/components/screenshot/ScreenshotsTextarea/calculateNodeSize.ts +117 -0
- package/src/components/screenshot/ScreenshotsTextarea/index.scss +19 -0
- package/src/components/screenshot/ScreenshotsTextarea/index.tsx +96 -0
- package/src/components/screenshot/composeImage.ts +57 -0
- package/src/components/screenshot/exports.ts +4 -0
- package/src/components/screenshot/hooks/useBounds.ts +35 -0
- package/src/components/screenshot/hooks/useCall.ts +17 -0
- package/src/components/screenshot/hooks/useCanvasContextRef.ts +8 -0
- package/src/components/screenshot/hooks/useCanvasMousedown.ts +13 -0
- package/src/components/screenshot/hooks/useCanvasMousemove.ts +13 -0
- package/src/components/screenshot/hooks/useCanvasMouseup.ts +13 -0
- package/src/components/screenshot/hooks/useCursor.ts +34 -0
- package/src/components/screenshot/hooks/useDispatcher.ts +8 -0
- package/src/components/screenshot/hooks/useDrawSelect.ts +16 -0
- package/src/components/screenshot/hooks/useEmiter.ts +61 -0
- package/src/components/screenshot/hooks/useHistory.ts +160 -0
- package/src/components/screenshot/hooks/useLang.ts +8 -0
- package/src/components/screenshot/hooks/useOperation.ts +37 -0
- package/src/components/screenshot/hooks/useReset.ts +26 -0
- package/src/components/screenshot/hooks/useStore.ts +8 -0
- package/src/components/screenshot/icons/iconfont.scss +88 -0
- package/src/components/screenshot/icons/iconfont.ttf +0 -0
- package/src/components/screenshot/icons/iconfont.woff +0 -0
- package/src/components/screenshot/icons/iconfont.woff2 +0 -0
- package/src/components/screenshot/index.tsx +169 -0
- package/src/components/screenshot/operations/Arrow/draw.ts +56 -0
- package/src/components/screenshot/operations/Arrow/index.tsx +193 -0
- package/src/components/screenshot/operations/Brush/draw.ts +45 -0
- package/src/components/screenshot/operations/Brush/index.tsx +169 -0
- package/src/components/screenshot/operations/Cancel/index.tsx +18 -0
- package/src/components/screenshot/operations/Ellipse/draw.ts +96 -0
- package/src/components/screenshot/operations/Ellipse/index.tsx +245 -0
- package/src/components/screenshot/operations/Mosaic/index.tsx +223 -0
- package/src/components/screenshot/operations/Ok/index.tsx +37 -0
- package/src/components/screenshot/operations/Pin/index.tsx +37 -0
- package/src/components/screenshot/operations/Rectangle/draw.ts +80 -0
- package/src/components/screenshot/operations/Rectangle/index.tsx +245 -0
- package/src/components/screenshot/operations/Redo/index.tsx +22 -0
- package/src/components/screenshot/operations/Save/index.tsx +37 -0
- package/src/components/screenshot/operations/Scan/index.tsx +46 -0
- package/src/components/screenshot/operations/Search/index.tsx +39 -0
- package/src/components/screenshot/operations/Text/index.tsx +307 -0
- package/src/components/screenshot/operations/Undo/index.tsx +22 -0
- package/src/components/screenshot/operations/index.ts +34 -0
- package/src/components/screenshot/operations/utils.ts +34 -0
- package/src/components/screenshot/screenshots.scss +13 -0
- package/src/components/screenshot/types.ts +53 -0
- package/src/components/screenshot/useGetLoadedImage.ts +29 -0
- package/src/components/screenshot/var.scss +107 -0
- package/src/components/screenshot/zh_CN.ts +37 -0
- package/src/emoji/100.gif +0 -0
- package/src/emoji/101.gif +0 -0
- package/src/emoji/102.gif +0 -0
- package/src/emoji/103.gif +0 -0
- package/src/emoji/104.gif +0 -0
- package/src/emoji/105.gif +0 -0
- package/src/emoji/106.gif +0 -0
- package/src/emoji/107.gif +0 -0
- package/src/emoji/108.gif +0 -0
- package/src/emoji/109.gif +0 -0
- package/src/emoji/110.gif +0 -0
- package/src/emoji/111.gif +0 -0
- package/src/emoji/112.gif +0 -0
- package/src/emoji/113.gif +0 -0
- package/src/emoji/114.gif +0 -0
- package/src/emoji/115.gif +0 -0
- package/src/emoji/116.gif +0 -0
- package/src/emoji/117.gif +0 -0
- package/src/emoji/118.gif +0 -0
- package/src/emoji/119.gif +0 -0
- package/src/emoji/120.gif +0 -0
- package/src/emoji/121.gif +0 -0
- package/src/emoji/122.gif +0 -0
- package/src/emoji/123.gif +0 -0
- package/src/emoji/124.gif +0 -0
- package/src/emoji/125.gif +0 -0
- package/src/emoji/126.gif +0 -0
- package/src/emoji/127.gif +0 -0
- package/src/emoji/128.gif +0 -0
- package/src/emoji/129.gif +0 -0
- package/src/emoji/130.gif +0 -0
- package/src/emoji/131.gif +0 -0
- package/src/emoji/132.gif +0 -0
- package/src/emoji/133.gif +0 -0
- package/src/emoji/134.gif +0 -0
- package/src/emoji/135.gif +0 -0
- package/src/emoji/136.gif +0 -0
- package/src/emoji/137.gif +0 -0
- package/src/emoji/138.gif +0 -0
- package/src/emoji/139.gif +0 -0
- package/src/emoji/140.gif +0 -0
- package/src/emoji/141.gif +0 -0
- package/src/emoji/142.gif +0 -0
- package/src/emoji/143.gif +0 -0
- package/src/emoji/144.gif +0 -0
- package/src/emoji/145.gif +0 -0
- package/src/emoji/146.gif +0 -0
- package/src/emoji/147.gif +0 -0
- package/src/emoji/148.gif +0 -0
- package/src/emoji/149.gif +0 -0
- package/src/emoji/150.gif +0 -0
- package/src/emoji/151.gif +0 -0
- package/src/emoji/152.gif +0 -0
- package/src/emoji/153.gif +0 -0
- package/src/emoji/154.gif +0 -0
- package/src/emoji/155.gif +0 -0
- package/src/emoji/156.gif +0 -0
- package/src/emoji/157.gif +0 -0
- package/src/emoji/158.gif +0 -0
- package/src/emoji/159.gif +0 -0
- package/src/emoji/160.gif +0 -0
- package/src/emoji/161.gif +0 -0
- package/src/emoji/162.gif +0 -0
- package/src/emoji/163.gif +0 -0
- package/src/emoji/164.gif +0 -0
- package/src/emoji/165.gif +0 -0
- package/src/emoji/166.gif +0 -0
- package/src/emoji/167.gif +0 -0
- package/src/emoji/168.gif +0 -0
- package/src/emoji/169.gif +0 -0
- package/src/emoji/170.gif +0 -0
- package/src/emoji/171.gif +0 -0
- package/src/emoji/172.gif +0 -0
- package/src/emoji/173.gif +0 -0
- package/src/emoji/174.gif +0 -0
- package/src/emoji/175.gif +0 -0
- package/src/emoji/176.gif +0 -0
- package/src/emoji/177.gif +0 -0
- package/src/emoji/178.gif +0 -0
- package/src/emoji/179.gif +0 -0
- package/src/emoji/180.gif +0 -0
- package/src/emoji/181.gif +0 -0
- package/src/emoji/182.gif +0 -0
- package/src/emoji/183.gif +0 -0
- package/src/emoji/184.gif +0 -0
- package/src/emoji/185.gif +0 -0
- package/src/emoji/186.gif +0 -0
- package/src/emoji/187.gif +0 -0
- package/src/emoji/188.gif +0 -0
- package/src/emoji/189.gif +0 -0
- package/src/emoji/190.gif +0 -0
- package/src/emoji/191.gif +0 -0
- package/src/emoji/192.gif +0 -0
- package/src/emoji/193.gif +0 -0
- package/src/emoji/194.gif +0 -0
- package/src/emoji/195.gif +0 -0
- package/src/emoji/196.gif +0 -0
- package/src/emoji/197.gif +0 -0
- package/src/emoji/198.gif +0 -0
- package/src/emoji/199.gif +0 -0
- package/src/emoji/200.png +0 -0
- package/src/emoji/201.png +0 -0
- package/src/emoji/202.png +0 -0
- package/src/emoji/203.png +0 -0
- package/src/emoji/204.png +0 -0
- package/src/emoji/205.png +0 -0
- package/src/emoji/206.png +0 -0
- package/src/emoji/207.png +0 -0
- package/src/emoji/208.png +0 -0
- package/src/emoji/209.png +0 -0
- package/src/emoji/210.png +0 -0
- package/src/emoji/211.png +0 -0
- package/src/emoji/212.png +0 -0
- package/src/emoji/213.png +0 -0
- package/src/emoji/214.png +0 -0
- package/src/emoji/215.png +0 -0
- package/src/emoji/216.png +0 -0
- package/src/emoji/217.png +0 -0
- package/src/emoji/218.png +0 -0
- package/src/emoji/219.png +0 -0
- package/src/emoji2/101--Streamline-The-Team.png +0 -0
- package/src/emoji2/128--Streamline-The-Team.png +0 -0
- package/src/emoji2/134--Streamline-The-Team.png +0 -0
- package/src/emoji2/173--Streamline-The-Team.png +0 -0
- package/src/emoji2/Airplane--Streamline-Emoji.svg +24 -0
- package/src/emoji2/Alien--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Amazed-Face--Streamline-Emoji.svg +16 -0
- package/src/emoji2/Amusing-Face--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Anguished-Face--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Anxious-Face--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Astonished-Face--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Backhand-Index-Pointing-Down-1--Streamline-Emoji.svg +12 -0
- package/src/emoji2/Backhand-Index-Pointing-Left-1--Streamline-Emoji.svg +13 -0
- package/src/emoji2/Backhand-Index-Pointing-Right-1--Streamline-Emoji.svg +13 -0
- package/src/emoji2/Backhand-Index-Pointing-Up-1--Streamline-Emoji.svg +14 -0
- package/src/emoji2/Bar-Chart--Streamline-Emoji.svg +22 -0
- package/src/emoji2/Beaming-Face-With-Smiling-Eyes--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Boy-1--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Boy-2--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Boy-3--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Broken-Heart--Streamline-Emoji.svg +12 -0
- package/src/emoji2/Clapping-Hands-1--Streamline-Emoji.svg +23 -0
- package/src/emoji2/Clinking-Glasses-2--Streamline-Emoji.svg +43 -0
- package/src/emoji2/Confounded-Face--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Confused-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Construction-Worker--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Couple-With-Heart-Woman-Man-1--Streamline-Emoji.svg +40 -0
- package/src/emoji2/Couple-With-Heart-Woman-Man-2--Streamline-Emoji.svg +40 -0
- package/src/emoji2/Cowboy-Hat-Face--Streamline-Emoji.svg +22 -0
- package/src/emoji2/Crazy-Face--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Crossed-Fingers-1--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Crown--Streamline-Emoji.svg +35 -0
- package/src/emoji2/Crying-Face--Streamline-Emoji.svg +26 -0
- package/src/emoji2/Delivery-Truck--Streamline-Emoji.svg +31 -0
- package/src/emoji2/Determined-Face--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Disappointed-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Dizzy-Face--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Downcast-Face-With-Sweat--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Drooling-Face-1--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Drooling-Face-2--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Ear--Streamline-Emoji.svg +14 -0
- package/src/emoji2/Exclamation-Mark--Streamline-Emoji.svg +12 -0
- package/src/emoji2/Exploding-Head--Streamline-Emoji.svg +24 -0
- package/src/emoji2/Expressionless-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Face-Blowing-A-Kiss--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Face-Savoring-Food--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Face-Screaming-In-Fear--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Face-Vomiting--Streamline-Emoji.svg +28 -0
- package/src/emoji2/Face-With-Head-Bandage--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Face-With-Medical-Mask--Streamline-Emoji.svg +23 -0
- package/src/emoji2/Face-With-Monocle--Streamline-Emoji.svg +26 -0
- package/src/emoji2/Face-With-Raised-Eyebrow--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Face-With-Rolling-Eyes--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Face-With-Steam-From-Nose--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Face-With-Symbols-On-Mouth--Streamline-Emoji.svg +22 -0
- package/src/emoji2/Face-With-Tears-Of-Joy--Streamline-Emoji.svg +34 -0
- package/src/emoji2/Face-With-Thermometer--Streamline-Emoji.svg +31 -0
- package/src/emoji2/Face-With-Tongue--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Face-Without-Mouth--Streamline-Emoji.svg +14 -0
- package/src/emoji2/Fearful-Face--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Flexed-Biceps-1--Streamline-Emoji.svg +13 -0
- package/src/emoji2/Flushed-Face--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Folded-Hands-1--Streamline-Emoji.svg +29 -0
- package/src/emoji2/Frowning-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Fuel-Pump--Streamline-Emoji.svg +30 -0
- package/src/emoji2/Girl-1--Streamline-Emoji.svg +23 -0
- package/src/emoji2/Glasses-1--Streamline-Emoji.svg +27 -0
- package/src/emoji2/Grimacing-Face--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Grinning-Cat-Face--Streamline-Emoji.svg +32 -0
- package/src/emoji2/Grinning-Face--Streamline-Emoji.svg +16 -0
- package/src/emoji2/Grinning-Face-With-Sweat--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Grinning-Squinting-Face--Streamline-Emoji.svg +16 -0
- package/src/emoji2/Hand-With-Fingers-Splayed-1--Streamline-Emoji.svg +14 -0
- package/src/emoji2/Heart-Suit--Streamline-Emoji.svg +9 -0
- package/src/emoji2/Hushed-Face-1--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Hushed-Face-2--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Index-Pointing-Up-1--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Kissing-Face-With-Closed-Eyes--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Loudly-Crying-Face--Streamline-Emoji.svg +16 -0
- package/src/emoji2/Lying-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Man-1--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Man-Facepalming-1--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Man-Gesturing-No-1--Streamline-Emoji.svg +34 -0
- package/src/emoji2/Man-Gesturing-Ok-1--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Man-Health-Worker-1--Streamline-Emoji.svg +41 -0
- package/src/emoji2/Man-Raising-Hand-1--Streamline-Emoji.svg +26 -0
- package/src/emoji2/Man-Shrugging-1--Streamline-Emoji.svg +31 -0
- package/src/emoji2/Money-Mouth-Face-2--Streamline-Emoji.svg +30 -0
- package/src/emoji2/Mouth--Streamline-Emoji.svg +12 -0
- package/src/emoji2/Nauseated-Face-2--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Neutral-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Ok-Hand-1--Streamline-Emoji.svg +14 -0
- package/src/emoji2/Old-Man-1--Streamline-Emoji.svg +27 -0
- package/src/emoji2/Old-Woman-1--Streamline-Emoji.svg +23 -0
- package/src/emoji2/Oncoming-Fist-1--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Person-Wearing-Turban-2--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Pile-Of-Poo--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Police-Car-Light--Streamline-Emoji.svg +26 -0
- package/src/emoji2/Rocket--Streamline-Emoji.svg +32 -0
- package/src/emoji2/Sailboat--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Shaved-Ice--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Shortcake-2--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Shushing-Face--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Sign-Of-The-Horns-1--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Sleeping-Face--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Slightly-Smiling-Face--Streamline-Emoji.svg +15 -0
- package/src/emoji2/Smiling-Face-With-Halo--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Smiling-Face-With-Heart-Eyes--Streamline-Emoji.svg +21 -0
- package/src/emoji2/Smirking-Face--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Sun-With-Face--Streamline-Emoji.svg +24 -0
- package/src/emoji2/Thumbs-Down-1--Streamline-Emoji.svg +20 -0
- package/src/emoji2/Thumbs-Up-1--Streamline-Emoji.svg +19 -0
- package/src/emoji2/Winking-Face--Streamline-Emoji.svg +18 -0
- package/src/emoji2/Woman-Gesturing-No-1--Streamline-Emoji.svg +34 -0
- package/src/emoji2/Woman-Gesturing-Ok-2--Streamline-Emoji.svg +25 -0
- package/src/emoji2/Woman-Raising-Hand-1--Streamline-Emoji.svg +26 -0
- package/src/emoji2/Womans-Sandal--Streamline-Emoji.svg +13 -0
- package/src/emoji2/Worried-Face--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Writing-Hand-1--Streamline-Emoji.svg +17 -0
- package/src/emoji2/Zipper-Mouth-Face--Streamline-Emoji.svg +21 -0
- package/src/index.js +19 -0
- package/src/services/burn-after-read-service.js +313 -0
- package/src/services/burn-after-read-service.test.js +325 -0
- package/src/services/dify-api.js +338 -0
- package/src/services/dify-api.test.js +376 -0
- package/src/services/scheduled-send-service.js +311 -0
- package/src/services/scheduled-send-service.test.js +317 -0
- package/src/styles/index.css +2368 -0
- package/src/utils/emoji.js +125 -0
- package/src/utils/emojiData.js +267 -0
- package/src/utils/eventEmitter.js +114 -0
- package/src/utils/state.js +224 -0
- package/src/utils/state.test.js +198 -0
- package/src/utils/storage.js +122 -0
- package/src/utils/storage.test.js +162 -0
- package/src/utils/validation.js +249 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import React, { ReactElement, useCallback, useRef, useState } from 'react'
|
|
2
|
+
import useCanvasContextRef from '../../hooks/useCanvasContextRef'
|
|
3
|
+
import useCanvasMousedown from '../../hooks/useCanvasMousedown'
|
|
4
|
+
import useCursor from '../../hooks/useCursor'
|
|
5
|
+
import useHistory from '../../hooks/useHistory'
|
|
6
|
+
import useOperation from '../../hooks/useOperation'
|
|
7
|
+
import ScreenshotsButton from '../../ScreenshotsButton'
|
|
8
|
+
import ScreenshotsSizeColor from '../../ScreenshotsSizeColor'
|
|
9
|
+
import {
|
|
10
|
+
HistoryItemEdit,
|
|
11
|
+
HistoryItemSource,
|
|
12
|
+
HistoryItemType,
|
|
13
|
+
Point
|
|
14
|
+
} from '../../types'
|
|
15
|
+
import ScreenshotsTextarea from '../../ScreenshotsTextarea'
|
|
16
|
+
import useBounds from '../../hooks/useBounds'
|
|
17
|
+
import useDrawSelect from '../../hooks/useDrawSelect'
|
|
18
|
+
import useCanvasMousemove from '../../hooks/useCanvasMousemove'
|
|
19
|
+
import useCanvasMouseup from '../../hooks/useCanvasMouseup'
|
|
20
|
+
import useLang from '../../hooks/useLang'
|
|
21
|
+
|
|
22
|
+
export interface TextData {
|
|
23
|
+
size: number;
|
|
24
|
+
color: string;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
text: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TextEditData {
|
|
32
|
+
x1: number;
|
|
33
|
+
x2: number;
|
|
34
|
+
y1: number;
|
|
35
|
+
y2: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TextareaBounds {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
maxWidth: number;
|
|
42
|
+
maxHeight: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const sizes: Record<number, number> = {
|
|
46
|
+
3: 18,
|
|
47
|
+
6: 32,
|
|
48
|
+
9: 46
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function draw (
|
|
52
|
+
ctx: CanvasRenderingContext2D,
|
|
53
|
+
action: HistoryItemSource<TextData, TextEditData>
|
|
54
|
+
) {
|
|
55
|
+
const { size, color, fontFamily, x, y, text } = action.data
|
|
56
|
+
ctx.fillStyle = color
|
|
57
|
+
ctx.textAlign = 'left'
|
|
58
|
+
ctx.textBaseline = 'top'
|
|
59
|
+
ctx.font = `${size}px ${fontFamily}`
|
|
60
|
+
|
|
61
|
+
const distance = action.editHistory.reduce(
|
|
62
|
+
(distance, { data }) => ({
|
|
63
|
+
x: distance.x + data.x2 - data.x1,
|
|
64
|
+
y: distance.y + data.y2 - data.y1
|
|
65
|
+
}),
|
|
66
|
+
{ x: 0, y: 0 }
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
text.split('\n').forEach((item, index) => {
|
|
70
|
+
ctx.fillText(item, x + distance.x, y + distance.y + index * size)
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isHit (
|
|
75
|
+
ctx: CanvasRenderingContext2D,
|
|
76
|
+
action: HistoryItemSource<TextData, TextEditData>,
|
|
77
|
+
point: Point
|
|
78
|
+
) {
|
|
79
|
+
ctx.textAlign = 'left'
|
|
80
|
+
ctx.textBaseline = 'top'
|
|
81
|
+
ctx.font = `${action.data.size}px ${action.data.fontFamily}`
|
|
82
|
+
|
|
83
|
+
let width = 0
|
|
84
|
+
let height = 0
|
|
85
|
+
|
|
86
|
+
action.data.text.split('\n').forEach((item) => {
|
|
87
|
+
const measured = ctx.measureText(item)
|
|
88
|
+
if (width < measured.width) {
|
|
89
|
+
width = measured.width
|
|
90
|
+
}
|
|
91
|
+
height += action.data.size
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const { x, y } = action.editHistory.reduce(
|
|
95
|
+
(distance, { data }) => ({
|
|
96
|
+
x: distance.x + data.x2 - data.x1,
|
|
97
|
+
y: distance.y + data.y2 - data.y1
|
|
98
|
+
}),
|
|
99
|
+
{ x: 0, y: 0 }
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
const left = action.data.x + x
|
|
103
|
+
const top = action.data.y + y
|
|
104
|
+
const right = left + width
|
|
105
|
+
const bottom = top + height
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
point.x >= left && point.x <= right && point.y >= top && point.y <= bottom
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default function Text (): ReactElement {
|
|
113
|
+
const lang = useLang()
|
|
114
|
+
const [history, historyDispatcher] = useHistory()
|
|
115
|
+
const [bounds] = useBounds()
|
|
116
|
+
const [operation, operationDispatcher] = useOperation()
|
|
117
|
+
const [, cursorDispatcher] = useCursor()
|
|
118
|
+
const canvasContextRef = useCanvasContextRef()
|
|
119
|
+
const [size, setSize] = useState(3)
|
|
120
|
+
const [color, setColor] = useState('#ee5126')
|
|
121
|
+
const textRef = useRef<HistoryItemSource<TextData, TextEditData> | null>(
|
|
122
|
+
null
|
|
123
|
+
)
|
|
124
|
+
const textEditRef = useRef<HistoryItemEdit<TextEditData, TextData> | null>(
|
|
125
|
+
null
|
|
126
|
+
)
|
|
127
|
+
const [textareaBounds, setTextareaBounds] = useState<TextareaBounds | null>(
|
|
128
|
+
null
|
|
129
|
+
)
|
|
130
|
+
const [text, setText] = useState<string>('')
|
|
131
|
+
|
|
132
|
+
const checked = operation === 'Text'
|
|
133
|
+
|
|
134
|
+
const selectText = useCallback(() => {
|
|
135
|
+
operationDispatcher.set('Text')
|
|
136
|
+
cursorDispatcher.set('default')
|
|
137
|
+
}, [operationDispatcher, cursorDispatcher])
|
|
138
|
+
|
|
139
|
+
const onSelectText = useCallback(() => {
|
|
140
|
+
if (checked) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
selectText()
|
|
144
|
+
historyDispatcher.clearSelect()
|
|
145
|
+
}, [checked, selectText, historyDispatcher])
|
|
146
|
+
|
|
147
|
+
const onSizeChange = useCallback((size: number) => {
|
|
148
|
+
if (textRef.current) {
|
|
149
|
+
textRef.current.data.size = sizes[size]
|
|
150
|
+
}
|
|
151
|
+
setSize(size)
|
|
152
|
+
}, [])
|
|
153
|
+
|
|
154
|
+
const onColorChange = useCallback((color: string) => {
|
|
155
|
+
if (textRef.current) {
|
|
156
|
+
textRef.current.data.color = color
|
|
157
|
+
}
|
|
158
|
+
setColor(color)
|
|
159
|
+
}, [])
|
|
160
|
+
|
|
161
|
+
const onTextareaChange = useCallback(
|
|
162
|
+
(value: string) => {
|
|
163
|
+
setText(value)
|
|
164
|
+
if (checked && textRef.current) {
|
|
165
|
+
textRef.current.data.text = value
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
[checked]
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
const onTextareaBlur = useCallback(() => {
|
|
172
|
+
if (textRef.current && textRef.current.data.text) {
|
|
173
|
+
historyDispatcher.push(textRef.current)
|
|
174
|
+
}
|
|
175
|
+
textRef.current = null
|
|
176
|
+
setText('')
|
|
177
|
+
setTextareaBounds(null)
|
|
178
|
+
}, [historyDispatcher])
|
|
179
|
+
|
|
180
|
+
const onDrawSelect = useCallback(
|
|
181
|
+
(action: HistoryItemSource<unknown, unknown>, e: MouseEvent) => {
|
|
182
|
+
if (action.name !== 'Text') {
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
selectText()
|
|
187
|
+
|
|
188
|
+
textEditRef.current = {
|
|
189
|
+
type: HistoryItemType.Edit,
|
|
190
|
+
data: {
|
|
191
|
+
x1: e.clientX,
|
|
192
|
+
y1: e.clientY,
|
|
193
|
+
x2: e.clientX,
|
|
194
|
+
y2: e.clientY
|
|
195
|
+
},
|
|
196
|
+
source: action as HistoryItemSource<TextData, TextEditData>
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
historyDispatcher.select(action)
|
|
200
|
+
},
|
|
201
|
+
[selectText, historyDispatcher]
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
const onMousedown = useCallback(
|
|
205
|
+
(e: MouseEvent) => {
|
|
206
|
+
if (!checked || !canvasContextRef.current || textRef.current || !bounds) {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
const { left, top } =
|
|
210
|
+
canvasContextRef.current.canvas.getBoundingClientRect()
|
|
211
|
+
const fontFamily = window.getComputedStyle(
|
|
212
|
+
canvasContextRef.current.canvas
|
|
213
|
+
).fontFamily
|
|
214
|
+
const x = e.clientX - left
|
|
215
|
+
const y = e.clientY - top
|
|
216
|
+
|
|
217
|
+
textRef.current = {
|
|
218
|
+
name: 'Text',
|
|
219
|
+
type: HistoryItemType.Source,
|
|
220
|
+
data: {
|
|
221
|
+
size: sizes[size],
|
|
222
|
+
color,
|
|
223
|
+
fontFamily,
|
|
224
|
+
x,
|
|
225
|
+
y,
|
|
226
|
+
text: ''
|
|
227
|
+
},
|
|
228
|
+
editHistory: [],
|
|
229
|
+
draw,
|
|
230
|
+
isHit
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
setTextareaBounds({
|
|
234
|
+
x: e.clientX,
|
|
235
|
+
y: e.clientY,
|
|
236
|
+
maxWidth: bounds.width - x,
|
|
237
|
+
maxHeight: bounds.height - y
|
|
238
|
+
})
|
|
239
|
+
},
|
|
240
|
+
[checked, size, color, bounds, canvasContextRef]
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
const onMousemove = useCallback(
|
|
244
|
+
(e: MouseEvent): void => {
|
|
245
|
+
if (!checked) {
|
|
246
|
+
return
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (textEditRef.current) {
|
|
250
|
+
textEditRef.current.data.x2 = e.clientX
|
|
251
|
+
textEditRef.current.data.y2 = e.clientY
|
|
252
|
+
if (history.top !== textEditRef.current) {
|
|
253
|
+
textEditRef.current.source.editHistory.push(textEditRef.current)
|
|
254
|
+
historyDispatcher.push(textEditRef.current)
|
|
255
|
+
} else {
|
|
256
|
+
historyDispatcher.set(history)
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
[checked, history, historyDispatcher]
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
const onMouseup = useCallback((): void => {
|
|
264
|
+
if (!checked) {
|
|
265
|
+
return
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
textEditRef.current = null
|
|
269
|
+
}, [checked])
|
|
270
|
+
|
|
271
|
+
useDrawSelect(onDrawSelect)
|
|
272
|
+
useCanvasMousedown(onMousedown)
|
|
273
|
+
useCanvasMousemove(onMousemove)
|
|
274
|
+
useCanvasMouseup(onMouseup)
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<>
|
|
278
|
+
<ScreenshotsButton
|
|
279
|
+
title={lang.operation_text_title}
|
|
280
|
+
icon='icon-text'
|
|
281
|
+
checked={checked}
|
|
282
|
+
onClick={onSelectText}
|
|
283
|
+
option={
|
|
284
|
+
<ScreenshotsSizeColor
|
|
285
|
+
size={size}
|
|
286
|
+
color={color}
|
|
287
|
+
onSizeChange={onSizeChange}
|
|
288
|
+
onColorChange={onColorChange}
|
|
289
|
+
/>
|
|
290
|
+
}
|
|
291
|
+
/>
|
|
292
|
+
{checked && textareaBounds && (
|
|
293
|
+
<ScreenshotsTextarea
|
|
294
|
+
x={textareaBounds.x}
|
|
295
|
+
y={textareaBounds.y}
|
|
296
|
+
maxWidth={textareaBounds.maxWidth}
|
|
297
|
+
maxHeight={textareaBounds.maxHeight}
|
|
298
|
+
size={sizes[size]}
|
|
299
|
+
color={color}
|
|
300
|
+
value={text}
|
|
301
|
+
onChange={onTextareaChange}
|
|
302
|
+
onBlur={onTextareaBlur}
|
|
303
|
+
/>
|
|
304
|
+
)}
|
|
305
|
+
</>
|
|
306
|
+
)
|
|
307
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactElement, useCallback } from 'react'
|
|
2
|
+
import ScreenshotsButton from '../../ScreenshotsButton'
|
|
3
|
+
import useHistory from '../../hooks/useHistory'
|
|
4
|
+
import useLang from '../../hooks/useLang'
|
|
5
|
+
|
|
6
|
+
export default function Undo (): ReactElement {
|
|
7
|
+
const lang = useLang()
|
|
8
|
+
const [history, historyDispatcher] = useHistory()
|
|
9
|
+
|
|
10
|
+
const onClick = useCallback(() => {
|
|
11
|
+
historyDispatcher.undo()
|
|
12
|
+
}, [historyDispatcher])
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ScreenshotsButton
|
|
16
|
+
title={lang.operation_undo_title}
|
|
17
|
+
icon='icon-undo'
|
|
18
|
+
disabled={history.index === -1}
|
|
19
|
+
onClick={onClick}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Ok from './Ok';
|
|
2
|
+
import Cancel from './Cancel';
|
|
3
|
+
import Save from './Save';
|
|
4
|
+
import Redo from './Redo';
|
|
5
|
+
import Undo from './Undo';
|
|
6
|
+
import Mosaic from './Mosaic';
|
|
7
|
+
import Text from './Text';
|
|
8
|
+
import Brush from './Brush';
|
|
9
|
+
import Arrow from './Arrow';
|
|
10
|
+
import Ellipse from './Ellipse';
|
|
11
|
+
import Rectangle from './Rectangle';
|
|
12
|
+
import Search from './Search';
|
|
13
|
+
import Scan from './Scan';
|
|
14
|
+
import Pin from './Pin';
|
|
15
|
+
|
|
16
|
+
export default [
|
|
17
|
+
Pin,
|
|
18
|
+
Scan,
|
|
19
|
+
Search,
|
|
20
|
+
'|',
|
|
21
|
+
Rectangle,
|
|
22
|
+
Ellipse,
|
|
23
|
+
Arrow,
|
|
24
|
+
Brush,
|
|
25
|
+
Text,
|
|
26
|
+
Mosaic,
|
|
27
|
+
'|',
|
|
28
|
+
Undo,
|
|
29
|
+
Redo,
|
|
30
|
+
'|',
|
|
31
|
+
Save,
|
|
32
|
+
Cancel,
|
|
33
|
+
Ok,
|
|
34
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HistoryItemSource, Point } from '../types'
|
|
2
|
+
|
|
3
|
+
const CircleRadius = 4
|
|
4
|
+
|
|
5
|
+
export function drawDragCircle (ctx: CanvasRenderingContext2D, x: number, y: number) {
|
|
6
|
+
ctx.lineWidth = 1
|
|
7
|
+
ctx.strokeStyle = '#000000'
|
|
8
|
+
ctx.fillStyle = '#ffffff'
|
|
9
|
+
|
|
10
|
+
ctx.beginPath()
|
|
11
|
+
ctx.arc(x, y, CircleRadius, 0, 2 * Math.PI)
|
|
12
|
+
ctx.fill()
|
|
13
|
+
ctx.stroke()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isHit<S, E> (ctx: CanvasRenderingContext2D, action: HistoryItemSource<S, E>, point: Point) {
|
|
17
|
+
action.draw(ctx, action)
|
|
18
|
+
const { data } = ctx.getImageData(point.x, point.y, 1, 1)
|
|
19
|
+
return data.some(val => val !== 0)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function isHitCircle (canvas: HTMLCanvasElement | null, e: MouseEvent, point: Point) {
|
|
23
|
+
if (!canvas) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { left, top } = canvas.getBoundingClientRect()
|
|
28
|
+
|
|
29
|
+
const x = e.clientX - left
|
|
30
|
+
const y = e.clientY - top
|
|
31
|
+
|
|
32
|
+
// 点到圆心的距离是否小于半径
|
|
33
|
+
return (point.x - x) ** 2 + (point.y - y) ** 2 < CircleRadius ** 2
|
|
34
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react'
|
|
2
|
+
|
|
3
|
+
export type CanvasContextRef = MutableRefObject<CanvasRenderingContext2D | null>
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
export type EmiterListener = (...args: any) => unknown
|
|
7
|
+
|
|
8
|
+
export type Emiter = Record<string, EmiterListener[]>
|
|
9
|
+
|
|
10
|
+
export type EmiterRef = MutableRefObject<Emiter>
|
|
11
|
+
|
|
12
|
+
export interface Point {
|
|
13
|
+
x: number
|
|
14
|
+
y: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum HistoryItemType {
|
|
18
|
+
Edit,
|
|
19
|
+
Source
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface HistoryItemEdit<E, S> {
|
|
23
|
+
type: HistoryItemType.Edit
|
|
24
|
+
data: E
|
|
25
|
+
source: HistoryItemSource<S, E>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HistoryItemSource<S, E> {
|
|
29
|
+
name: string
|
|
30
|
+
type: HistoryItemType.Source
|
|
31
|
+
data: S
|
|
32
|
+
isSelected?: boolean
|
|
33
|
+
editHistory: HistoryItemEdit<E, S>[]
|
|
34
|
+
draw: (ctx: CanvasRenderingContext2D, action: HistoryItemSource<S, E>) => void
|
|
35
|
+
isHit?: (ctx: CanvasRenderingContext2D, action: HistoryItemSource<S, E>, point: Point) => boolean
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type HistoryItem<S, E> = HistoryItemEdit<E, S> | HistoryItemSource<S, E>
|
|
39
|
+
|
|
40
|
+
export interface History {
|
|
41
|
+
index: number
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
stack: HistoryItem<any, any>[]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface Bounds {
|
|
47
|
+
x: number
|
|
48
|
+
y: number
|
|
49
|
+
width: number
|
|
50
|
+
height: number
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type Position = Point
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
export default function useGetLoadedImage (url?: string): HTMLImageElement | null {
|
|
4
|
+
const [image, setImage] = useState<HTMLImageElement | null>(null)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
// 先置空图片
|
|
8
|
+
setImage(null)
|
|
9
|
+
if (url == null) {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const $image = document.createElement('img')
|
|
14
|
+
|
|
15
|
+
const onLoad = () => setImage($image)
|
|
16
|
+
const onError = () => setImage(null)
|
|
17
|
+
|
|
18
|
+
$image.addEventListener('load', onLoad)
|
|
19
|
+
$image.addEventListener('error', onError)
|
|
20
|
+
$image.src = url
|
|
21
|
+
|
|
22
|
+
return () => {
|
|
23
|
+
$image.removeEventListener('load', onLoad)
|
|
24
|
+
$image.removeEventListener('error', onError)
|
|
25
|
+
}
|
|
26
|
+
}, [url])
|
|
27
|
+
|
|
28
|
+
return image
|
|
29
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
$border-color: #39f;
|
|
2
|
+
$point-color: $border-color;
|
|
3
|
+
$font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
|
|
4
|
+
Helvetica Neue, Arial, Noto Sans, sans-serif, apple color emoji,
|
|
5
|
+
segoe ui emoji, Segoe UI Symbol, noto color emoji;
|
|
6
|
+
|
|
7
|
+
$borders:
|
|
8
|
+
// left,top,width,height,transform
|
|
9
|
+
(
|
|
10
|
+
"top": (
|
|
11
|
+
left: 0,
|
|
12
|
+
top: 0,
|
|
13
|
+
width: 100%,
|
|
14
|
+
height: 2px,
|
|
15
|
+
transform: translateY(-50%),
|
|
16
|
+
),
|
|
17
|
+
),
|
|
18
|
+
(
|
|
19
|
+
"right": (
|
|
20
|
+
left: 100%,
|
|
21
|
+
top: 0,
|
|
22
|
+
width: 2px,
|
|
23
|
+
height: 100%,
|
|
24
|
+
transform: translateX(-50%),
|
|
25
|
+
),
|
|
26
|
+
),
|
|
27
|
+
(
|
|
28
|
+
"bottom": (
|
|
29
|
+
left: 0,
|
|
30
|
+
top: 100%,
|
|
31
|
+
width: 100%,
|
|
32
|
+
height: 2px,
|
|
33
|
+
transform: translateY(-50%),
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
(
|
|
37
|
+
"left": (
|
|
38
|
+
left: 0,
|
|
39
|
+
top: 0,
|
|
40
|
+
width: 2px,
|
|
41
|
+
height: 100%,
|
|
42
|
+
transform: translateX(-50%),
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
$points:
|
|
47
|
+
// left,top,cursor
|
|
48
|
+
(
|
|
49
|
+
top: (
|
|
50
|
+
left: 50%,
|
|
51
|
+
top: 0,
|
|
52
|
+
cursor: ns-resize,
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
(
|
|
56
|
+
top-right: (
|
|
57
|
+
left: 100%,
|
|
58
|
+
top: 0,
|
|
59
|
+
cursor: nesw-resize,
|
|
60
|
+
),
|
|
61
|
+
),
|
|
62
|
+
(
|
|
63
|
+
right: (
|
|
64
|
+
left: 100%,
|
|
65
|
+
top: 50%,
|
|
66
|
+
cursor: ew-resize,
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
(
|
|
70
|
+
right-bottom: (
|
|
71
|
+
left: 100%,
|
|
72
|
+
top: 100%,
|
|
73
|
+
cursor: nwse-resize,
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
(
|
|
77
|
+
bottom: (
|
|
78
|
+
left: 50%,
|
|
79
|
+
top: 100%,
|
|
80
|
+
cursor: ns-resize,
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
(
|
|
84
|
+
bottom-left: (
|
|
85
|
+
left: 0,
|
|
86
|
+
top: 100%,
|
|
87
|
+
cursor: nesw-resize,
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
(
|
|
91
|
+
left: (
|
|
92
|
+
left: 0,
|
|
93
|
+
top: 50%,
|
|
94
|
+
cursor: ew-resize,
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
(
|
|
98
|
+
left-top: (
|
|
99
|
+
left: 0,
|
|
100
|
+
top: 0,
|
|
101
|
+
cursor: nwse-resize,
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
$button-size: 35px;
|
|
106
|
+
|
|
107
|
+
$sizecolor-size: 35px;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface Lang {
|
|
2
|
+
magnifier_position_label: string;
|
|
3
|
+
operation_ok_title: string;
|
|
4
|
+
operation_cancel_title: string;
|
|
5
|
+
operation_save_title: string;
|
|
6
|
+
operation_redo_title: string;
|
|
7
|
+
operation_undo_title: string;
|
|
8
|
+
operation_mosaic_title: string;
|
|
9
|
+
operation_text_title: string;
|
|
10
|
+
operation_brush_title: string;
|
|
11
|
+
operation_arrow_title: string;
|
|
12
|
+
operation_ellipse_title: string;
|
|
13
|
+
operation_rectangle_title: string;
|
|
14
|
+
operation_search_title: string;
|
|
15
|
+
operation_scan_title: string;
|
|
16
|
+
operation_pin_title: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const zhCN: Lang = {
|
|
20
|
+
magnifier_position_label: '坐标',
|
|
21
|
+
operation_ok_title: '确定',
|
|
22
|
+
operation_cancel_title: '取消',
|
|
23
|
+
operation_save_title: '保存',
|
|
24
|
+
operation_redo_title: '重做',
|
|
25
|
+
operation_undo_title: '撤销',
|
|
26
|
+
operation_mosaic_title: '马赛克',
|
|
27
|
+
operation_text_title: '文本',
|
|
28
|
+
operation_brush_title: '画笔',
|
|
29
|
+
operation_arrow_title: '箭头',
|
|
30
|
+
operation_ellipse_title: '椭圆',
|
|
31
|
+
operation_rectangle_title: '矩形',
|
|
32
|
+
operation_search_title: '搜图',
|
|
33
|
+
operation_scan_title: '扫码',
|
|
34
|
+
operation_pin_title: '贴图',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default zhCN;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|