rename enum name ScaleType.Tile.

This commit is contained in:
吴尚昆 2022-03-18 19:37:41 +08:00 committed by osborn
parent 55ff312312
commit ed9475b72a
10 changed files with 17 additions and 15 deletions

View File

@ -225,7 +225,7 @@ class ImageDemo extends Panel {
width: 84 * 3, width: 84 * 3,
imageScale: 1, imageScale: 1,
backgroundColor: Color.BLACK, backgroundColor: Color.BLACK,
scaleType: ScaleType.ScaleToTile, scaleType: ScaleType.Tile,
layoutConfig: layoutConfig().just(), layoutConfig: layoutConfig().just(),
}), }),
@ -242,7 +242,7 @@ class ImageDemo extends Panel {
height: 288, height: 288,
width: 154, width: 154,
imageScale: 2, imageScale: 2,
scaleType: ScaleType.ScaleToTile, scaleType: ScaleType.Tile,
layoutConfig: layoutConfig().just(), layoutConfig: layoutConfig().just(),
}), }),
], ],

View File

@ -85,7 +85,6 @@ @interface DoricImageNode ()
@property(nonatomic, strong) UIVisualEffectView *blurEffectView; @property(nonatomic, strong) UIVisualEffectView *blurEffectView;
@property(nonatomic, strong) NSDictionary *stretchInsetDic; @property(nonatomic, strong) NSDictionary *stretchInsetDic;
@property(nonatomic, assign) CGFloat imageScale; @property(nonatomic, assign) CGFloat imageScale;
@property(nonatomic, strong) NSDictionary *props;
@property(nonatomic, assign) NSInteger scaleType; @property(nonatomic, assign) NSInteger scaleType;
@end @end
@ -125,7 +124,6 @@ - (void)blend:(NSDictionary *)props {
[props[@"loadCallback"] also:^(NSString *it) { [props[@"loadCallback"] also:^(NSString *it) {
self.loadCallbackId = it; self.loadCallbackId = it;
}]; }];
self.props = props;
[super blend:props]; [super blend:props];
} }
@ -284,7 +282,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
[self callJSResponse:self.loadCallbackId, nil]; [self callJSResponse:self.loadCallbackId, nil];
} }
} }
[self afterBlended:self.props]; [self resizingImageIfNeeded];
}]; }];
}]; }];
[asyncResult setExceptionCallback:^(NSException *e) { [asyncResult setExceptionCallback:^(NSException *e) {
@ -335,7 +333,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
if (async && self.needReload) { if (async && self.needReload) {
[self.superNode subNodeContentChanged:self]; [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.superNode subNodeContentChanged:self];
} }
} }
[self afterBlended:self.props]; [self resizingImageIfNeeded];
}]; }];
#else #else
DoricLog(@"Do not support load image url"); DoricLog(@"Do not support load image url");
@ -672,6 +670,10 @@ - (UIImage *)imageFromData:(NSData *)imgData {
} }
- (void)afterBlended:(NSDictionary *)props { - (void)afterBlended:(NSDictionary *)props {
[self resizingImageIfNeeded];
}
- (void)resizingImageIfNeeded {
if (CGSizeEqualToSize(self.view.image.size, CGSizeZero)) { if (CGSizeEqualToSize(self.view.image.size, CGSizeZero)) {
return; return;
} }

View File

@ -2288,7 +2288,7 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; ScaleType[ScaleType["Tile"] = 3] = "Tile";
})(exports.ScaleType || (exports.ScaleType = {})); })(exports.ScaleType || (exports.ScaleType = {}));
var Image = /** @class */ (function (_super) { var Image = /** @class */ (function (_super) {
__extends$e(Image, _super); __extends$e(Image, _super);

View File

@ -1706,7 +1706,7 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; ScaleType[ScaleType["Tile"] = 3] = "Tile";
})(exports.ScaleType || (exports.ScaleType = {})); })(exports.ScaleType || (exports.ScaleType = {}));
class Image extends View { class Image extends View {
isAnimating(context) { isAnimating(context) {

View File

@ -3234,7 +3234,7 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; ScaleType[ScaleType["Tile"] = 3] = "Tile";
})(exports.ScaleType || (exports.ScaleType = {})); })(exports.ScaleType || (exports.ScaleType = {}));
class Image extends View { class Image extends View {
isAnimating(context) { isAnimating(context) {

2
doric-js/index.d.ts vendored
View File

@ -626,7 +626,7 @@ declare module 'doric/lib/src/widget/image' {
ScaleToFill = 0, ScaleToFill = 0,
ScaleAspectFit = 1, ScaleAspectFit = 1,
ScaleAspectFill = 2, ScaleAspectFill = 2,
ScaleToTile = 3 Tile = 3
} }
export class Image extends View { export class Image extends View {
/** /**

View File

@ -6,7 +6,7 @@ export declare enum ScaleType {
ScaleToFill = 0, ScaleToFill = 0,
ScaleAspectFit = 1, ScaleAspectFit = 1,
ScaleAspectFill = 2, ScaleAspectFill = 2,
ScaleToTile = 3 Tile = 3
} }
export declare class Image extends View { export declare class Image extends View {
/** /**

View File

@ -31,7 +31,7 @@ export var ScaleType;
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; ScaleType[ScaleType["Tile"] = 3] = "Tile";
})(ScaleType || (ScaleType = {})); })(ScaleType || (ScaleType = {}));
export class Image extends View { export class Image extends View {
isAnimating(context) { isAnimating(context) {

View File

@ -23,7 +23,7 @@ export enum ScaleType {
ScaleToFill = 0, ScaleToFill = 0,
ScaleAspectFit, ScaleAspectFit,
ScaleAspectFill, ScaleAspectFill,
ScaleToTile, // image tile mode Tile, // image tile mode
} }
export class Image extends View { export class Image extends View {

View File

@ -3308,7 +3308,7 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill"; ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit"; ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill"; ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
ScaleType[ScaleType["ScaleToTile"] = 3] = "ScaleToTile"; ScaleType[ScaleType["Tile"] = 3] = "Tile";
})(exports.ScaleType || (exports.ScaleType = {})); })(exports.ScaleType || (exports.ScaleType = {}));
class Image extends View { class Image extends View {
isAnimating(context) { isAnimating(context) {