feat:blendProps for Cooridinate changes
This commit is contained in:
@@ -92,6 +92,7 @@ - (void)verticalScrolling:(NSDictionary *)params withPromise:(DoricPromise *)pro
|
||||
green:startG + (endG - startG) * rate
|
||||
blue:startB + (endB - startB) * rate
|
||||
alpha:startA + (endA - startA) * rate];
|
||||
value = DoricColorToNumber(value);
|
||||
} else {
|
||||
value = @([changingStart floatValue] + ([changingEnd floatValue] - [changingStart floatValue]) * rate);
|
||||
}
|
||||
@@ -105,24 +106,11 @@ - (void)verticalScrolling:(NSDictionary *)params withPromise:(DoricPromise *)pro
|
||||
}
|
||||
|
||||
- (void)setValue:(DoricViewNode *)viewNode isNavBar:(BOOL)isNavBar name:(NSString *)name value:(id)value {
|
||||
if ([@"backgroundColor" isEqualToString:name]) {
|
||||
if ([value isKindOfClass:[NSNumber class]]) {
|
||||
value = DoricColor(value);
|
||||
}
|
||||
if (isNavBar) {
|
||||
[self.doricContext.navBar doric_navBar_setBackgroundColor:value];
|
||||
} else {
|
||||
viewNode.view.backgroundColor = value;
|
||||
}
|
||||
} else if ([@"width" isEqualToString:name]) {
|
||||
viewNode.view.width = [value floatValue];
|
||||
} else if ([@"height" isEqualToString:name]) {
|
||||
viewNode.view.height = [value floatValue];
|
||||
} else if ([@"x" isEqualToString:name]) {
|
||||
viewNode.view.left = [value floatValue];
|
||||
} else if ([@"y" isEqualToString:name]) {
|
||||
viewNode.view.top = [value floatValue];
|
||||
if ([@"backgroundColor" isEqualToString:name] && isNavBar) {
|
||||
[self.doricContext.navBar doric_navBar_setBackgroundColor:DoricColor(value)];
|
||||
} else {
|
||||
[viewNode blend:@{name: value}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
@@ -27,6 +27,8 @@ void DoricLog(NSString *_Nonnull format, ...);
|
||||
|
||||
UIColor *_Nonnull DoricColor(NSNumber *_Nonnull number);
|
||||
|
||||
NSNumber *_Nonnull DoricColorToNumber(UIColor *_Nonnull color);
|
||||
|
||||
NSBundle *_Nonnull DoricBundle(void);
|
||||
|
||||
#ifndef DC_LOCK
|
||||
@@ -39,4 +41,4 @@ NSBundle *_Nonnull DoricBundle(void);
|
||||
|
||||
void ShowToast(NSString *_Nonnull text, DoricGravity gravity);
|
||||
|
||||
UIImage *_Nonnull UIImageWithColor(UIColor * _Nonnull color);
|
||||
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
||||
|
@@ -41,6 +41,15 @@ void DoricLog(NSString *_Nonnull format, ...) {
|
||||
return [UIColor colorWithRed:r green:g blue:b alpha:a];
|
||||
}
|
||||
|
||||
NSNumber *DoricColorToNumber(UIColor *color) {
|
||||
CGFloat r, g, b, a;
|
||||
[color getRed:&r green:&g blue:&b alpha:&a];
|
||||
return @((((long) (a * 225) & 0xff) << 24)
|
||||
| (((long) (r * 225) & 0xff) << 16)
|
||||
| (((long) (g * 225) & 0xff) << 8)
|
||||
| (((long) (b * 225) & 0xff) << 0));
|
||||
}
|
||||
|
||||
NSBundle *DoricBundle() {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[DoricContext class]];
|
||||
NSURL *url = [bundle URLForResource:@"Doric" withExtension:@"bundle"];
|
||||
|
Reference in New Issue
Block a user