diff --git a/doric-demo/src/ImageDemo.ts b/doric-demo/src/ImageDemo.ts index 5490df02..f4ee79d7 100644 --- a/doric-demo/src/ImageDemo.ts +++ b/doric-demo/src/ImageDemo.ts @@ -225,7 +225,7 @@ class ImageDemo extends Panel { width: 84 * 3, imageScale: 1, backgroundColor: Color.BLACK, - scaleType: ScaleType.ScaleToTile, + scaleType: ScaleType.Tile, layoutConfig: layoutConfig().just(), }), @@ -242,7 +242,7 @@ class ImageDemo extends Panel { height: 288, width: 154, imageScale: 2, - scaleType: ScaleType.ScaleToTile, + scaleType: ScaleType.Tile, layoutConfig: layoutConfig().just(), }), ], diff --git a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m index c8d5a6f6..b5d559b9 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m @@ -85,7 +85,6 @@ @interface DoricImageNode () @property(nonatomic, strong) UIVisualEffectView *blurEffectView; @property(nonatomic, strong) NSDictionary *stretchInsetDic; @property(nonatomic, assign) CGFloat imageScale; -@property(nonatomic, strong) NSDictionary *props; @property(nonatomic, assign) NSInteger scaleType; @end @@ -125,7 +124,6 @@ - (void)blend:(NSDictionary *)props { [props[@"loadCallback"] also:^(NSString *it) { self.loadCallbackId = it; }]; - self.props = props; [super blend:props]; } @@ -284,7 +282,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id [self callJSResponse:self.loadCallbackId, nil]; } } - [self afterBlended:self.props]; + [self resizingImageIfNeeded]; }]; }]; [asyncResult setExceptionCallback:^(NSException *e) { @@ -335,7 +333,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id if (async && self.needReload) { [self.superNode subNodeContentChanged:self]; } - [self afterBlended:self.props]; + [self resizingImageIfNeeded]; } }]; }); @@ -375,7 +373,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id [self.superNode subNodeContentChanged:self]; } } - [self afterBlended:self.props]; + [self resizingImageIfNeeded]; }]; #else DoricLog(@"Do not support load image url"); @@ -672,6 +670,10 @@ - (UIImage *)imageFromData:(NSData *)imgData { } - (void)afterBlended:(NSDictionary *)props { + [self resizingImageIfNeeded]; +} + +- (void)resizingImageIfNeeded { if (CGSizeEqualToSize(self.view.image.size, CGSizeZero)) { return; } diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index 00c9578e..2c020b79 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -2288,7 +2288,7 @@ exports.ScaleType = void 0; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; - ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; + ScaleType[ScaleType["Tile"] = 3] = "Tile"; })(exports.ScaleType || (exports.ScaleType = {})); var Image = /** @class */ (function (_super) { __extends$e(Image, _super); diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index 1e501363..11f713f5 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1706,7 +1706,7 @@ exports.ScaleType = void 0; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; - ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; + ScaleType[ScaleType["Tile"] = 3] = "Tile"; })(exports.ScaleType || (exports.ScaleType = {})); class Image extends View { isAnimating(context) { diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index e31c4cdc..c9f1d89d 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -3234,7 +3234,7 @@ exports.ScaleType = void 0; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; - ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; + ScaleType[ScaleType["Tile"] = 3] = "Tile"; })(exports.ScaleType || (exports.ScaleType = {})); class Image extends View { isAnimating(context) { diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 344fea1c..7292c116 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -626,7 +626,7 @@ declare module 'doric/lib/src/widget/image' { ScaleToFill = 0, ScaleAspectFit = 1, ScaleAspectFill = 2, - ScaleToTile = 3 + Tile = 3 } export class Image extends View { /** diff --git a/doric-js/lib/src/widget/image.d.ts b/doric-js/lib/src/widget/image.d.ts index c447e8c3..2495c746 100644 --- a/doric-js/lib/src/widget/image.d.ts +++ b/doric-js/lib/src/widget/image.d.ts @@ -6,7 +6,7 @@ export declare enum ScaleType { ScaleToFill = 0, ScaleAspectFit = 1, ScaleAspectFill = 2, - ScaleToTile = 3 + Tile = 3 } export declare class Image extends View { /** diff --git a/doric-js/lib/src/widget/image.js b/doric-js/lib/src/widget/image.js index 8500c121..26942d8b 100644 --- a/doric-js/lib/src/widget/image.js +++ b/doric-js/lib/src/widget/image.js @@ -31,7 +31,7 @@ export var ScaleType; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; - ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; + ScaleType[ScaleType["Tile"] = 3] = "Tile"; })(ScaleType || (ScaleType = {})); export class Image extends View { isAnimating(context) { diff --git a/doric-js/src/widget/image.ts b/doric-js/src/widget/image.ts index 079a5ba9..89ae36e1 100644 --- a/doric-js/src/widget/image.ts +++ b/doric-js/src/widget/image.ts @@ -23,7 +23,7 @@ export enum ScaleType { ScaleToFill = 0, ScaleAspectFit, ScaleAspectFill, - ScaleToTile, // image tile mode + Tile, // image tile mode } export class Image extends View { diff --git a/doric-web/dist/index.js b/doric-web/dist/index.js index bed88176..2a10cfee 100644 --- a/doric-web/dist/index.js +++ b/doric-web/dist/index.js @@ -3308,7 +3308,7 @@ exports.ScaleType = void 0; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; - ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; + ScaleType[ScaleType["Tile"] = 3] = "Tile"; })(exports.ScaleType || (exports.ScaleType = {})); class Image extends View { isAnimating(context) {