Skip to content

Commit

Permalink
update: 更新橡皮擦转换逻辑 (#89)
Browse files Browse the repository at this point in the history
Co-authored-by: yanheng <yanheng@siactpower.com>
  • Loading branch information
JessYan0913 and yanheng authored Aug 30, 2024
1 parent 2ba88b7 commit a5ec620
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pictode/src/assets/images/round-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pictode/src/assets/images/round.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion pictode/src/view/canvas/components/Tools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { injectStrict } from '@pictode/vue-aide';
import round from '@/assets/images/round.svg';
import roundLight from '@/assets/images/round-light.svg';
import { PictodeAppKey } from '@/constants/inject-key';
import useTheme from '@/hooks/useTheme';
Expand Down Expand Up @@ -222,7 +223,7 @@ const tools: ToolInfo[] = [
new EraserTool({
hooks: {
onActive(app) {
app.containerElement.style.cursor = `url(${round}), auto`;
app.containerElement.style.cursor = eraserCursor.value;
},
onInactive(app) {
app.containerElement.style.cursor = `default`;
Expand Down Expand Up @@ -256,6 +257,15 @@ const tools: ToolInfo[] = [
const currentTool = ref<string>(tools[0].name);
const { theme } = useTheme();
const strokeColor = computed<string>(() => (theme.value === 'dark' ? '#d1d5db' : '#333333'));
const eraserCursor = computed<string>(() =>
theme.value === 'dark' ? `url(${roundLight}), auto` : `url(${round}), auto`
);
watchEffect(() => {
if (currentTool.value === 'eraserTool') {
app.containerElement.style.cursor = eraserCursor.value;
}
});
watchEffect(async () => {
let tool = tools.find(({ name }) => name === currentTool.value)?.tool;
Expand Down

0 comments on commit a5ec620

Please sign in to comment.