-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91c764f
commit 4223c28
Showing
32 changed files
with
322 additions
and
367 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,4 +137,5 @@ export { | |
maximizeShotScreenWin, | ||
unmaximizeShotScreenWin, | ||
downloadURLShotScreenWin, | ||
copyImg, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,4 @@ | |
"engines": { | ||
"node": "^14.18.0 || >=16.0.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,88 @@ | ||
@font-face { | ||
font-family: "screenshots-icon"; /* Project id 572327 */ | ||
src: url("iconfont.woff2") format("woff2"), | ||
url("iconfont.woff") format("woff"), url("iconfont.ttf") format("truetype"); | ||
font-family: 'screenshots-icon'; /* Project id 572327 */ | ||
src: url('iconfont.woff2') format('woff2'), url('iconfont.woff') format('woff'), | ||
url('iconfont.ttf') format('truetype'); | ||
} | ||
|
||
[class^="icon-"], | ||
[class*=" icon-"] { | ||
font-family: "screenshots-icon" !important; | ||
font-style: normal; | ||
line-height: 1; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
[class^='icon-'], | ||
[class*=' icon-'] { | ||
font-family: 'screenshots-icon' !important; | ||
font-style: normal; | ||
line-height: 1; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
.icon-ok:before { | ||
content: "\e001"; | ||
content: '\e001'; | ||
} | ||
|
||
.icon-cancel:before { | ||
content: "\e002"; | ||
content: '\e002'; | ||
} | ||
|
||
.icon-save:before { | ||
content: "\e003"; | ||
content: '\e003'; | ||
} | ||
|
||
.icon-redo:before { | ||
content: "\e004"; | ||
content: '\e004'; | ||
} | ||
|
||
.icon-undo:before { | ||
content: "\e005"; | ||
content: '\e005'; | ||
} | ||
|
||
.icon-mosaic:before { | ||
content: "\e006"; | ||
content: '\e006'; | ||
} | ||
|
||
.icon-text:before { | ||
content: "\e007"; | ||
content: '\e007'; | ||
} | ||
|
||
.icon-brush:before { | ||
content: "\e008"; | ||
content: '\e008'; | ||
} | ||
|
||
.icon-arrow:before { | ||
content: "\e009"; | ||
content: '\e009'; | ||
} | ||
|
||
.icon-ellipse:before { | ||
content: "\e00a"; | ||
content: '\e00a'; | ||
} | ||
|
||
.icon-rectangle:before { | ||
content: "\e00b"; | ||
content: '\e00b'; | ||
} | ||
|
||
.icon-scan:before { | ||
content: ""; | ||
background: transparent url(/imgs/svg/scan.svg) no-repeat 0px 0px; | ||
background-size: 22px; | ||
background-position: center; | ||
width: 35px; | ||
height: 35px; | ||
display: inline-block; | ||
content: ''; | ||
background: transparent url(/imgs/svg/scan.svg) no-repeat 0px 0px; | ||
background-size: 22px; | ||
background-position: center; | ||
width: 35px; | ||
height: 35px; | ||
display: inline-block; | ||
} | ||
|
||
.icon-search:before { | ||
content: ""; | ||
background: transparent url(/imgs/svg/search.svg) no-repeat 0px 0px; | ||
background-size: 22px; | ||
background-position: center; | ||
width: 35px; | ||
height: 35px; | ||
display: inline-block; | ||
content: ''; | ||
background: transparent url(/imgs/svg/search.svg) no-repeat 0px 0px; | ||
background-size: 22px; | ||
background-position: center; | ||
width: 35px; | ||
height: 35px; | ||
display: inline-block; | ||
} | ||
|
||
.icon-pin:before { | ||
content: ''; | ||
background: transparent url(/imgs/svg/pin.svg) no-repeat 0px 0px; | ||
background-size: 22px; | ||
background-position: center; | ||
width: 35px; | ||
height: 35px; | ||
display: inline-block; | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/screenshot/src/Screenshots/operations/Pin/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { ReactElement, useCallback } from 'react'; | ||
import useStore from '../../hooks/useStore'; | ||
import useCall from '../../hooks/useCall'; | ||
import useCanvasContextRef from '../../hooks/useCanvasContextRef'; | ||
import useHistory from '../../hooks/useHistory'; | ||
import useReset from '../../hooks/useReset'; | ||
import ScreenshotsButton from '../../ScreenshotsButton'; | ||
import composeImage from '../../composeImage'; | ||
|
||
export default function Pin(): ReactElement { | ||
const { image, width, height, history, bounds, lang } = useStore(); | ||
const canvasContextRef = useCanvasContextRef(); | ||
const [, historyDispatcher] = useHistory(); | ||
const call = useCall(); | ||
const reset = useReset(); | ||
|
||
const onClick = useCallback(() => { | ||
historyDispatcher.clearSelect(); | ||
setTimeout(() => { | ||
if (!canvasContextRef.current || !image || !bounds) { | ||
return; | ||
} | ||
composeImage({ | ||
image, | ||
width, | ||
height, | ||
history, | ||
bounds, | ||
}).then((blob) => { | ||
call('onPin', blob, bounds); | ||
reset(); | ||
}); | ||
}); | ||
}, [canvasContextRef, historyDispatcher, image, width, height, history, bounds, call, reset]); | ||
|
||
return <ScreenshotsButton title={lang.operation_scan_title} icon="icon-pin" onClick={onClick} />; | ||
} |
Oops, something went wrong.