Skip to content

Commit

Permalink
fix proxyData
Browse files Browse the repository at this point in the history
  • Loading branch information
leaferjs committed Nov 30, 2023
1 parent ac3978f commit 3db27fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
11 changes: 6 additions & 5 deletions packages/display/src/UI.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IAround, ILeafDataOptions, IFindMethod } from '@leafer/interface'
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IAround, IFindMethod } from '@leafer/interface'
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType } from '@leafer/core'

import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IFindUIMethod, IEditSize, ILeafer } from '@leafer-ui/interface'
Expand All @@ -19,7 +19,8 @@ export class UI extends Leaf implements IUI {
@dataProcessor(UIData)
declare public __: IUIData

declare public proxyData?: IUIInputData
declare public proxyData?: IUIInputData // need rewrite getter
declare public __proxyData?: IUIInputData

public get app(): ILeafer { return this.leafer && this.leafer.app }

Expand Down Expand Up @@ -230,11 +231,11 @@ export class UI extends Leaf implements IUI {
Object.assign(this, data)
}

public get(options?: ILeafDataOptions): IUIInputData {
return this.__.__getInputData(options)
public get(): IUIInputData {
return this.__.__getInputData()
}

public getProxyData(): IUIInputData { return undefined }
public createProxyData(): IUIInputData { return undefined }


// find
Expand Down
7 changes: 4 additions & 3 deletions packages/interface/src/IUI.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ILeaf, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IBlob, IPathCreator, AnswerType } from '@leafer/interface'
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IPathDrawer, IPointData, IPath2D, IPathCommandData, IWindingRule, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IBlob, IPathCreator, AnswerType } from '@leafer/interface'

import {
IFillAttrData, IFillInputData, IFillComputedData,
Expand Down Expand Up @@ -275,6 +275,7 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
isFrame?: boolean

proxyData?: IUIInputData
__proxyData?: IUIInputData

children?: IUI[]

Expand All @@ -283,8 +284,8 @@ export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrDa
set(data: IUIInputData): void
toJSON(): IUIInputData

get(options?: ILeafDataOptions): IUIInputData
getProxyData(): IUIInputData
get(): IUIInputData
createProxyData(): IUIInputData

find(condition: number | string | IFindUIMethod, options?: any): IUI[]
findOne(condition: number | string | IFindUIMethod, options?: any): IUI
Expand Down
4 changes: 4 additions & 0 deletions packages/partner/paint/src/paint/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function hasNaturalSize(ui: IUI, attrName: string, image: ISizeData): boolean {
d.__naturalWidth = image.width
d.__naturalHeight = image.height
if (!d.__getInput('width') || !d.__getInput('height')) {
if (ui.__proxyData) {
ui.setProxyAttr('width', ui.__.width)
ui.setProxyAttr('height', ui.__.height)
}
ui.forceUpdate('width')
return false
}
Expand Down

0 comments on commit 3db27fc

Please sign in to comment.