-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 49ceb0dfc100c3885800a531ec5b777a5063653a Author: kanno <[email protected]> Date: Tue Dec 10 15:19:40 2024 +0800 light event feat: init trackpad logic chore: remove cache chore: remove unused type change try add cache clean code commit c6947c0 Author: kanno <[email protected]> Date: Tue Dec 10 09:56:52 2024 +0800 round
- Loading branch information
Showing
20 changed files
with
749 additions
and
689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { DisplayType, Graph } from './display' | ||
import type { GraphOptions, GraphStyleSheet } from './display' | ||
|
||
export interface BitmapOptions extends Omit<GraphOptions, 'style'> { | ||
style: Partial< | ||
GraphStyleSheet & { | ||
font: string, | ||
textAlign: CanvasTextAlign, | ||
baseline: CanvasTextBaseline, | ||
lineWidth: number, | ||
fill: string | ||
} | ||
> | ||
bitmap: HTMLCanvasElement | ||
} | ||
|
||
export class Bitmap extends Graph { | ||
bitmap: HTMLCanvasElement | null | ||
style: Required<BitmapOptions['style']> | ||
constructor(options: Partial<BitmapOptions> = {}) { | ||
super(options) | ||
this.bitmap = options.bitmap || null | ||
this.style = (options.style || Object.create(null)) as Required<BitmapOptions['style']> | ||
} | ||
create() { | ||
if (this.bitmap) { | ||
this.instruction.drawImage(this.bitmap, 0, 0) | ||
} | ||
} | ||
clone() { | ||
return new Bitmap({ ...this.style, ...this.__options__ }) | ||
} | ||
get __shape__() { | ||
return DisplayType.Bitmap | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export { Box } from './box' | ||
export { Layer } from './layer' | ||
export { Rect } from './rect' | ||
export { Bitmap } from './image' | ||
export { RoundRect } from './rect' | ||
export { Text } from './text' | ||
export * from './types' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.