Skip to content

Commit

Permalink
Revert "style: change cursor to a crosshair dot"
Browse files Browse the repository at this point in the history
This reverts commit cb85cc6.
  • Loading branch information
robertrosman committed May 14, 2024
1 parent 4818629 commit 72323ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
21 changes: 3 additions & 18 deletions src/components/PaintEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const {
minX, minY, maxX, maxY,
top, left, bottom, right, width, height,
posStart, posEnd,
isDrawing, isInside
isDrawing
} = useDraw({
container,
onDrawStart() {
Expand Down Expand Up @@ -104,26 +104,11 @@ function clear() {
emit('clear')
}
const crosshairPath = computed(() => {
const offset = Number(settings.value.thickness)
return `
M${x.value - 8 - offset} ${y.value} L${x.value - 2 - offset} ${y.value}
M${x.value + 8 + offset} ${y.value} L${x.value + 2 + offset} ${y.value}
M${x.value} ${y.value - 8 - offset} L${x.value} ${y.value - 2 - offset}
M${x.value} ${y.value + 8 + offset} L${x.value} ${y.value + 2 + offset}
`
})
</script>

<template>
<div ref="container" class="container">
<paint-renderer :tools :activeShape :history :width :height>
<slot name="cursor">
<path v-if="isInside" :d="`M${x} ${y} L${x} ${y}`" class="freehand" :stroke="settings.color" :stroke-width="settings.thickness" />
<path v-if="isInside" :d="crosshairPath" class="freehand" stroke="gray" stroke-width="1" />
</slot>
</paint-renderer>
<paint-renderer :tools :activeShape :history :width :height />

<slot name="toolbar" :undo :save :clear :settings>
<DefaultToolbar v-model:settings="settings" @undo="undo" @save="save" @clear="clear" :tools
Expand All @@ -137,7 +122,7 @@ const crosshairPath = computed(() => {
<style scoped>
.container {
position: relative;
cursor: none;
cursor: crosshair;
}
:deep(.toolbar) {
Expand Down
1 change: 0 additions & 1 deletion src/components/PaintRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const highLayers = computed(() => props.tools.filter(tool => tool.toolSvg && (to
<component v-for="shape, i in history" :key="i" :is="getTool(shape.type)?.shapeSvg" :shape :history />
<component v-if="activeShape" :is="getTool(activeShape.type)?.shapeSvg" :shape="activeShape" :history :width
:height />
<slot></slot>
<component v-for="tool in highLayers" :key="tool.type" :is="tool.toolSvg" :history :activeShape :width
:height />
<svg:style>{{ style }}</svg:style>
Expand Down

0 comments on commit 72323ea

Please sign in to comment.