iOS:fix Slider and rotation
This commit is contained in:
parent
102f570fb4
commit
f3c8d1be31
@ -161,6 +161,9 @@ - (void)layout {
|
||||
}
|
||||
|
||||
- (void)setFrame {
|
||||
if (!CGAffineTransformEqualToTransform(self.view.transform, CGAffineTransformIdentity)) {
|
||||
return;
|
||||
}
|
||||
[self.view.subviews forEach:^(__kindof UIView *obj) {
|
||||
[obj.doricLayout setFrame];
|
||||
}];
|
||||
|
@ -21,15 +21,6 @@
|
||||
//
|
||||
#import "DoricSlideItemNode.h"
|
||||
|
||||
@interface DoricSlideItemView : UIView
|
||||
@end
|
||||
|
||||
@implementation DoricSlideItemView
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation DoricSlideItemNode
|
||||
|
||||
- (instancetype)initWithContext:(DoricContext *)doricContext {
|
||||
@ -45,7 +36,7 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode {
|
||||
self.view.clipsToBounds = YES;
|
||||
}
|
||||
|
||||
- (DoricSlideItemView *)build {
|
||||
return [DoricSlideItemView new];
|
||||
- (void)requestLayout {
|
||||
[self.view.doricLayout apply];
|
||||
}
|
||||
@end
|
@ -44,24 +44,6 @@ @interface DoricSliderView : UICollectionView
|
||||
@end
|
||||
|
||||
@implementation DoricSliderView
|
||||
//- (CGSize)sizeThatFits:(CGSize)size {
|
||||
// if (self.subviews.count > 0) {
|
||||
// CGFloat width = size.width;
|
||||
// CGFloat height = size.height;
|
||||
// for (UIView *child in self.subviews) {
|
||||
// CGSize childSize = [child measureSize:size];
|
||||
// width = MAX(childSize.width, width);
|
||||
// height = MAX(childSize.height, height);
|
||||
// }
|
||||
// return CGSizeMake(width, height);
|
||||
// }
|
||||
// return size;
|
||||
//}
|
||||
//
|
||||
//- (void)layoutSelf:(CGSize)targetSize {
|
||||
// [super layoutSelf:targetSize];
|
||||
// [self reloadData];
|
||||
//}
|
||||
@end
|
||||
|
||||
@implementation DoricSliderNode
|
||||
@ -138,13 +120,13 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
|
||||
DoricSlideItemNode *slideItemNode = [[DoricSlideItemNode alloc] initWithContext:self.doricContext];
|
||||
[slideItemNode initWithSuperNode:self];
|
||||
cell.doricSlideItemNode = slideItemNode;
|
||||
slideItemNode.view.width = collectionView.width;
|
||||
slideItemNode.view.height = collectionView.height;
|
||||
[cell.contentView addSubview:slideItemNode.view];
|
||||
}
|
||||
DoricSlideItemNode *node = cell.doricSlideItemNode;
|
||||
node.viewId = model[@"id"];
|
||||
[node blend:props];
|
||||
// CGSize size = [node.view measureSize:CGSizeMake(collectionView.width, collectionView.height)];
|
||||
// [node.view layoutSelf:size];
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,8 @@ - (void)blend:(NSDictionary *)props {
|
||||
}
|
||||
[self blendView:self.view forPropName:key propValue:value];
|
||||
}
|
||||
[self transformProperties];
|
||||
[self afterBlended:props];
|
||||
[self transformProperties];
|
||||
[self requestLayout];
|
||||
self.gradientLayer.frame = CGRectMake(0, 0, self.view.width, self.view.height);
|
||||
}
|
||||
@ -157,14 +157,10 @@ - (void)transformProperties {
|
||||
if (self.rotation) {
|
||||
transform = CGAffineTransformRotate(transform, (self.rotation.floatValue ?: 0) * M_PI);
|
||||
}
|
||||
if (self.pivotX || self.pivotY) {
|
||||
self.view.layer.anchorPoint = CGPointMake(self.pivotX.floatValue
|
||||
?: 0.5f, self.pivotY.floatValue ?: 0.5f);
|
||||
}
|
||||
if (!CGAffineTransformEqualToTransform(transform, self.view.transform)) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.view.transform = transform;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2015,7 +2015,7 @@ function slider(config) {
|
||||
}
|
||||
function slideItem(item, config) {
|
||||
return (new SlideItem).also(function (it) {
|
||||
it.layoutConfig = layoutConfig().fit();
|
||||
it.layoutConfig = layoutConfig().most();
|
||||
if (item instanceof View) {
|
||||
it.addChild(item);
|
||||
}
|
||||
|
@ -1512,7 +1512,7 @@ function slider(config) {
|
||||
}
|
||||
function slideItem(item, config) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = layoutConfig().fit();
|
||||
it.layoutConfig = layoutConfig().most();
|
||||
if (item instanceof View) {
|
||||
it.addChild(item);
|
||||
}
|
||||
|
@ -2971,7 +2971,7 @@ function slider(config) {
|
||||
}
|
||||
function slideItem(item, config) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = layoutConfig().fit();
|
||||
it.layoutConfig = layoutConfig().most();
|
||||
if (item instanceof View) {
|
||||
it.addChild(item);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ export function slider(config) {
|
||||
}
|
||||
export function slideItem(item, config) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = layoutConfig().fit();
|
||||
it.layoutConfig = layoutConfig().most();
|
||||
if (item instanceof View) {
|
||||
it.addChild(item);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ export function slider(config: ISlider) {
|
||||
|
||||
export function slideItem(item: View | View[], config?: ISlideItem) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = layoutConfig().fit()
|
||||
it.layoutConfig = layoutConfig().most()
|
||||
if (item instanceof View) {
|
||||
it.addChild(item)
|
||||
} else {
|
||||
|
2
doric-web/dist/index.js
vendored
2
doric-web/dist/index.js
vendored
@ -3029,7 +3029,7 @@ function slider(config) {
|
||||
}
|
||||
function slideItem(item, config) {
|
||||
return (new SlideItem).also((it) => {
|
||||
it.layoutConfig = layoutConfig().fit();
|
||||
it.layoutConfig = layoutConfig().most();
|
||||
if (item instanceof View) {
|
||||
it.addChild(item);
|
||||
}
|
||||
|
Reference in New Issue
Block a user