diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index 4e41599d..b7e27380 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -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]; }]; diff --git a/doric-iOS/Pod/Classes/Shader/DoricSlideItemNode.m b/doric-iOS/Pod/Classes/Shader/DoricSlideItemNode.m index 706cb808..3b9c45c0 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricSlideItemNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricSlideItemNode.m @@ -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 \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m b/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m index 8c4f4deb..a9d2bd71 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m @@ -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; } diff --git a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m index 6f510446..bc72455c 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m @@ -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); - } + 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; - }); + self.view.transform = transform; } } diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index d2818cde..39c76840 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -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); } diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index 2b25c175..c621c4a6 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -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); } diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index b999fb2d..e29d1552 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -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); } diff --git a/doric-js/lib/src/widget/slider.js b/doric-js/lib/src/widget/slider.js index a09b21af..24b9c603 100644 --- a/doric-js/lib/src/widget/slider.js +++ b/doric-js/lib/src/widget/slider.js @@ -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); } diff --git a/doric-js/src/widget/slider.ts b/doric-js/src/widget/slider.ts index 87793304..dcf6b5af 100644 --- a/doric-js/src/widget/slider.ts +++ b/doric-js/src/widget/slider.ts @@ -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 { diff --git a/doric-web/dist/index.js b/doric-web/dist/index.js index e42cf350..b8586634 100644 --- a/doric-web/dist/index.js +++ b/doric-web/dist/index.js @@ -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); }