Skip to content

Commit

Permalink
fix: export image
Browse files Browse the repository at this point in the history
  • Loading branch information
leaferjs committed Oct 12, 2023
1 parent 35acb73 commit 6cd3afa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/interface/src/type/IComputedType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IBlendMode, ILeaferImage, IMatrixData } from '@leafer/interface'
import { IBlendMode, ILeaferImage, IMatrixData, ITaskItem } from '@leafer/interface'

import { IColorString } from './IStringType'
import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode } from './IType'
Expand All @@ -15,6 +15,7 @@ export interface ILeafPaint {
image?: ILeaferImage
loadId?: number
patternId?: string
patternTask?: ITaskItem
data?: ILeafPaintPatternData
}

Expand Down
9 changes: 6 additions & 3 deletions packages/partner/paint/src/paint/image/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ export function checkImage(ui: IUI, canvas: ILeaferCanvas, paint: ILeafPaint, al
if (!paint.style) {
createPattern(ui, paint, canvas.pixelRatio)
} else {
ImageManager.patternTasker.add(async () => {
if (canvas.bounds.hit(ui.__world) && createPattern(ui, paint, canvas.pixelRatio)) ui.forceUpdate('surface')
}, 300)
if (!paint.patternTask) {
paint.patternTask = ImageManager.patternTasker.add(async () => {
paint.patternTask = null
if (canvas.bounds.hit(ui.__world) && createPattern(ui, paint, canvas.pixelRatio)) ui.forceUpdate('surface')
}, 300)
}
}
return false
}
Expand Down

0 comments on commit 6cd3afa

Please sign in to comment.