Skip to content

Commit

Permalink
chore: small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jan 24, 2024
1 parent eb9fb75 commit addf7c4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/painter/icon.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family: 'luna-painter-icon';
src: url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAWsAAsAAAAACNgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAGkAAACQIVkl8k9TLzIAAAF0AAAAQAAAAFZL/UkiY21hcAAAAbQAAADUAAACeqrBOT1nbHlmAAACiAAAAQoAAAFIJXA1lWhlYWQAAAOUAAAAMwAAADZzrr4+aGhlYQAAA8gAAAAcAAAAJAGSANlobXR4AAAD5AAAABQAAABEAlj//2xvY2EAAAP4AAAAEgAAACQEsgUAbWF4cAAABAwAAAAfAAAAIAEfAEZuYW1lAAAELAAAASkAAAIWm5e+CnBvc3QAAAVYAAAAUgAAAHM8IYupeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiC2YWBm4GGQYdACizMysAIhGwM7WI6FgQmIOYF2cYN5zEAZXiCPj4GfQQAowgwU42DgAQCWwAaOAAAAeJxjYGRQZpzAwMrAwFDH0AMkZaB0AgMngzEDAxMDKzMDVhCQ5prCcIAh8SMzwwkgV4jhJAMLkGYEyQEAYkcIrXiczZJBboMwEEWfMQ0QEoKyjKKeoJdK20hFqlBEFKkH6iqnyVU4AfmDJ4uq2y461gP5G0bf/gaegCheRA7hSsDqW2qY9chy1nO+NN/SSsk40vFJz4kzlzFOk9YOfLg2SAuz9rOC/t+x9/GsAZU6N9SsKdmo+5KVXBUs9HVm3sLiV5+/rypv6jWUGx4WzMH/qdX8vPmsxU47UYlXRwny5jTi3anF0dEulVOiFJ2jnSu9hPXvHaWvRBPmYnDs5pydQ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dgBM5AEItEAcA')
format('woff');
}

Expand All @@ -23,3 +23,6 @@
.icon-pencil:before {
content: '\f103';
}
.icon-zoom:before {
content: '\f104';
}
6 changes: 6 additions & 0 deletions src/painter/icon/zoom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion src/painter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import $ from 'licia/$'
import each from 'licia/each'
import ResizeSensor from 'licia/ResizeSensor'
import { exportCjs, drag, measuredScrollbarWidth } from '../share/util'
import { Brush, Pencil, Hand, Tool } from './tools'
import { Brush, Pencil, Hand, Zoom, Tool } from './tools'

const $document = $(document as any)

Expand Down Expand Up @@ -38,6 +38,7 @@ export default class Painter extends Component<IOptions> {
private brush: Brush
private pencil: Pencil
private hand: Hand
private zoom: Zoom
private activeLayer: Layer
private resizeSensor: ResizeSensor
constructor(container: HTMLElement, options: IOptions = {}) {
Expand Down Expand Up @@ -72,6 +73,7 @@ export default class Painter extends Component<IOptions> {
this.brush = new Brush(this)
this.pencil = new Pencil(this)
this.hand = new Hand(this)
this.zoom = new Zoom(this)

this.useTool(this.options.tool)
}
Expand Down Expand Up @@ -110,6 +112,8 @@ export default class Painter extends Component<IOptions> {
return this.pencil
case 'hand':
return this.hand
case 'zoom':
return this.zoom
}
}
getCanvas() {
Expand Down Expand Up @@ -138,6 +142,9 @@ export default class Painter extends Component<IOptions> {
<div class="tool" data-tool="hand">
<span class="icon icon-hand"></span>
</div>
<div class="tool" data-tool="zoom">
<span class="icon icon-zoom"></span>
</div>
</div>
<div class="viewport">
<div class="body">
Expand Down
2 changes: 2 additions & 0 deletions src/painter/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ export class Hand extends Tool {
viewport.scrollTop = this.startScrollTop - deltaY
}
}

export class Zoom extends Tool {}

0 comments on commit addf7c4

Please sign in to comment.