Skip to content

Commit

Permalink
fix: canvas size with zoom (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
devlzl authored Feb 19, 2024
1 parent ecb3237 commit a0aa261
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/BlockHub/CanvasBlock/Canvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const render = () => {
}
context.save()
context.strokeStyle = 'black'
context.lineWidth = 1
context.lineWidth = 2
context.beginPath()
const start = points.get(0) as OriginMap
context.moveTo(start.x as number, start.y as number)
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/ToolBox/controller/PenToolController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { toSlideCoords } from '@Utils/toSlideCoords'
import { ToolController } from './_ToolController'
import { CanvasBlock } from '@BlockHub/CanvasBlock/CanvasBlock'
import { selectionManager, slideManager, toolBox } from '@Kernel/index'
import { selectionManager, slideManager, toolBox, zoom } from '@Kernel/index'
import { ArrayStore } from '@Kernel/Store/ArrayStore'
import { OriginMap } from '@Kernel/Store/_Store'

Expand All @@ -16,7 +16,7 @@ export class PenToolController extends ToolController {
this._drawing = true
const slideElement = event.currentTarget as HTMLElement
const slideRect = slideElement.getBoundingClientRect()
this._canvasBlock = new CanvasBlock(0, 0, slideRect.width, slideRect.height)
this._canvasBlock = new CanvasBlock(0, 0, slideRect.width / zoom.value, slideRect.height / zoom.value)
slideManager.currentSlide.addBlock(this._canvasBlock)
}

Expand Down

0 comments on commit a0aa261

Please sign in to comment.