Skip to content

Commit

Permalink
fix: config not working, wrong tooltip position
Browse files Browse the repository at this point in the history
  • Loading branch information
CatsJuice committed Jul 22, 2023
1 parent 5f9f0e1 commit be0ee53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/SvgCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const brushworkLines = computed(() => lines.value.map((line) => {
watch([
() => props.replayOptions,
() => props.drawOptions,
() => props.width,
() => props.height,
], submitSvg, { deep: true })
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function onShare(e: MouseEvent) {
const url = createShareUrl(svgRef.value?.lines, { drawOptions, replayOptions, brushOptions, width: width.value, height: height.value })
copy(url)
const target = e.target as HTMLElement
createToast(target, 'Share link copied!')
createToast(target, 'Share link copied!', { position: 'top' })
}
function debugPane() {
Expand Down
6 changes: 4 additions & 2 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ html {
content: "";
display: block;
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border: 0.25rem solid transparent;
border-bottom-color: #222;
}
.toast--top::after {
top: 100%;
border-top-color: #222;
}
6 changes: 5 additions & 1 deletion src/utils/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export function createToast(
toast.style.position = 'fixed'
toast.style.zIndex = '999'
toast.style.left = `${rect.left + rect.width / 2}px`
toast.style.top = `${rect.bottom + 10}px`
if (options?.position === 'top')
toast.style.bottom = `${window.innerHeight - rect.top + 10}px`
else if (options?.position === 'bottom')
toast.style.top = `${rect.bottom + 10}px`

toast.style.transform = 'translateX(-50%)'
toast.style.opacity = '1'
toast.style.transition = 'opacity 0.3s ease'
Expand Down

0 comments on commit be0ee53

Please sign in to comment.