@leafer/debug
Advanced tools
+3
-3
| { | ||
| "name": "@leafer/debug", | ||
| "version": "1.5.3", | ||
| "version": "1.6.0", | ||
| "description": "@leafer/debug", | ||
@@ -25,7 +25,7 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/math": "1.5.3" | ||
| "@leafer/math": "1.6.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.5.3" | ||
| "@leafer/interface": "1.6.0" | ||
| } | ||
| } |
+21
-4
@@ -1,3 +0,6 @@ | ||
| import { IBooleanMap } from '@leafer/interface' | ||
| import { IBooleanMap, IBoundsData, ILeaferCanvas, IRenderOptions, ILeaf } from '@leafer/interface' | ||
| import { MathHelper } from '@leafer/math' | ||
| const { randColor } = MathHelper | ||
| export class Debug { | ||
@@ -12,5 +15,4 @@ | ||
| static showWarn = true | ||
| static showRepaint: boolean | ||
| static showHitView: boolean | string | string[] | ||
| static showBoundsView: boolean | string | string[] | ||
| static showRepaint: boolean | string | ||
| static showBounds: boolean | string | 'hit' | ||
@@ -37,3 +39,18 @@ public name: string | ||
| static drawRepaint(canvas: ILeaferCanvas, bounds: IBoundsData): void { | ||
| const color = randColor() | ||
| canvas.fillWorld(bounds, color.replace('1)', '.1)')) | ||
| canvas.strokeWorld(bounds, color) | ||
| } | ||
| static drawBounds(leaf: ILeaf, canvas: ILeaferCanvas, _options: IRenderOptions): void { | ||
| const showHit = Debug.showBounds === 'hit', w = leaf.__nowWorld, color = randColor() | ||
| if (showHit) canvas.setWorld(w), leaf.__drawHitPath(canvas), canvas.fillStyle = color.replace('1)', '.2)'), canvas.fill() | ||
| canvas.resetTransform() | ||
| canvas.setStroke(color, 2) | ||
| showHit ? canvas.stroke() : canvas.strokeWorld(w, color) | ||
| } | ||
| log(...messages: unknown[]): void { | ||
@@ -40,0 +57,0 @@ if (D.enable) { |
+1
-1
@@ -22,3 +22,3 @@ import { IBooleanMap } from '@leafer/interface' | ||
| need(name: string): any { | ||
| console.error('need plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name) | ||
| console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name) | ||
| } | ||
@@ -25,0 +25,0 @@ |
+5
-4
@@ -1,2 +0,2 @@ | ||
| import { IBooleanMap } from '@leafer/interface'; | ||
| import { IBooleanMap, ILeaferCanvas, IBoundsData, ILeaf, IRenderOptions } from '@leafer/interface'; | ||
@@ -25,5 +25,4 @@ interface ids { | ||
| static showWarn: boolean; | ||
| static showRepaint: boolean; | ||
| static showHitView: boolean | string | string[]; | ||
| static showBoundsView: boolean | string | string[]; | ||
| static showRepaint: boolean | string; | ||
| static showBounds: boolean | string | 'hit'; | ||
| name: string; | ||
@@ -35,2 +34,4 @@ repeatMap: IBooleanMap; | ||
| static set exclude(name: string | string[]); | ||
| static drawRepaint(canvas: ILeaferCanvas, bounds: IBoundsData): void; | ||
| static drawBounds(leaf: ILeaf, canvas: ILeaferCanvas, _options: IRenderOptions): void; | ||
| log(...messages: unknown[]): void; | ||
@@ -37,0 +38,0 @@ tip(...messages: unknown[]): void; |
7709
13.65%167
9.15%+ Added
- Removed
Updated