mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(collectionRepeat): automatically set width/height style to match collection-item-{width,height}
Closes #3034. Closes #1806.
This commit is contained in:
@@ -61,7 +61,6 @@ function($cacheFactory, $parse, $rootScope) {
|
||||
|
||||
item.scope = this.scope.$new();
|
||||
this.transcludeFn(item.scope, function(clone) {
|
||||
clone.css('position', 'absolute');
|
||||
item.element = clone;
|
||||
});
|
||||
this.transcludeParent.append(item.element);
|
||||
|
||||
14
js/angular/service/collectionRepeatManager.js
vendored
14
js/angular/service/collectionRepeatManager.js
vendored
@@ -310,15 +310,25 @@ function($rootScope, $timeout) {
|
||||
renderItem: function(dataIndex, primaryPos, secondaryPos) {
|
||||
// Attach an item, and set its transform position to the required value
|
||||
var item = this.dataSource.attachItemAtIndex(dataIndex);
|
||||
var itemDimensions = this.dimensions[dataIndex];
|
||||
//console.log(dataIndex, item);
|
||||
if (item && item.element) {
|
||||
if (item.primaryPos !== primaryPos || item.secondaryPos !== secondaryPos) {
|
||||
item.element.css(ionic.CSS.TRANSFORM, this.transformString(
|
||||
item.element[0].style[ionic.CSS.TRANSFORM] = this.transformString(
|
||||
primaryPos, secondaryPos
|
||||
));
|
||||
);
|
||||
item.primaryPos = primaryPos;
|
||||
item.secondaryPos = secondaryPos;
|
||||
}
|
||||
|
||||
var width = this.isVertical ? itemDimensions.secondarySize : itemDimensions.primarySize;
|
||||
var height = this.isVertical ? itemDimensions.primarySize : itemDimensions.secondarySize;
|
||||
if (item.cssWidth !== width) {
|
||||
item.element[0].style.width = (item.cssWidth = width) + 'px';
|
||||
}
|
||||
if (item.cssHeight !== height) {
|
||||
item.element[0].style.height = (item.cssHeight = height) + 'px';
|
||||
}
|
||||
// Save the item in rendered items
|
||||
this.renderedItems[dataIndex] = item;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user