mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Added support for offset start scroll view
This commit is contained in:
4
dist/js/ionic-angular.js
vendored
4
dist/js/ionic-angular.js
vendored
@@ -1229,6 +1229,8 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
|
||||
hasScrollY: '@',
|
||||
scrollbarX: '@',
|
||||
scrollbarY: '@',
|
||||
startX: '@',
|
||||
startY: '@',
|
||||
scrollEventInterval: '@'
|
||||
},
|
||||
|
||||
@@ -1274,6 +1276,8 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
|
||||
sv = new ionic.views.Scroll({
|
||||
el: $element[0],
|
||||
bouncing: enableBouncing,
|
||||
startX: $scope.$eval($scope.startX) || 0,
|
||||
startY: $scope.$eval($scope.startY) || 0,
|
||||
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
|
||||
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
|
||||
scrollingX: $scope.$eval($scope.hasScrollX) === true,
|
||||
|
||||
2
dist/js/ionic-angular.min.js
vendored
2
dist/js/ionic-angular.min.js
vendored
File diff suppressed because one or more lines are too long
6
dist/js/ionic.js
vendored
6
dist/js/ionic.js
vendored
@@ -2388,6 +2388,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
scrollingY: true,
|
||||
scrollbarY: true,
|
||||
|
||||
startX: 0,
|
||||
startY: 0,
|
||||
|
||||
/** The minimum size the scrollbars scale to while scrolling */
|
||||
minScrollbarSizeX: 5,
|
||||
minScrollbarSizeY: 5,
|
||||
@@ -2467,6 +2470,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
});
|
||||
};
|
||||
|
||||
this.__scrollLeft = this.options.startX;
|
||||
this.__scrollTop = this.options.startY;
|
||||
|
||||
// Get the render update function, initialize event handlers,
|
||||
// and calculate the size of the scroll container
|
||||
this.__callback = this.getRenderFn();
|
||||
|
||||
4
dist/js/ionic.min.js
vendored
4
dist/js/ionic.min.js
vendored
File diff suppressed because one or more lines are too long
4
js/ext/angular/src/directive/ionicContent.js
vendored
4
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -39,6 +39,8 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
|
||||
hasScrollY: '@',
|
||||
scrollbarX: '@',
|
||||
scrollbarY: '@',
|
||||
startX: '@',
|
||||
startY: '@',
|
||||
scrollEventInterval: '@'
|
||||
},
|
||||
|
||||
@@ -84,6 +86,8 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
|
||||
sv = new ionic.views.Scroll({
|
||||
el: $element[0],
|
||||
bouncing: enableBouncing,
|
||||
startX: $scope.$eval($scope.startX) || 0,
|
||||
startY: $scope.$eval($scope.startY) || 0,
|
||||
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
|
||||
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
|
||||
scrollingX: $scope.$eval($scope.hasScrollX) === true,
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
bottom: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
#search-box {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.scroll {
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
@@ -60,6 +65,7 @@
|
||||
<header-bar id="header" title="'Title'" type="bar-primary" hides-header></header-bar>
|
||||
|
||||
<content id="container"
|
||||
start-y="55"
|
||||
on-scroll="onScroll(event, scrollTop, scrollLeft)"
|
||||
on-scroll-complete="onScrollComplete(scrollTop, scrollLeft)"
|
||||
on-refresh="onRefresh()"
|
||||
@@ -69,6 +75,15 @@
|
||||
has-tabs="true"
|
||||
has-header="true"
|
||||
>
|
||||
<div id="search-box" class="bar bar-header item-input-inset">
|
||||
<label class="item-input-wrapper">
|
||||
<i class="icon ion-ios7-search placeholder-icon"></i>
|
||||
<input type="search" placeholder="Search">
|
||||
</label>
|
||||
<button class="button button-clear">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
<button ng-click="add()">Click</button>
|
||||
<ul class="list" ng-controller="AppCtrl">
|
||||
<li class="list-item" ng-repeat="item in items">asdf{{$index}}</li>
|
||||
|
||||
@@ -39,4 +39,14 @@ describe('Ionic Content directive', function() {
|
||||
var scrollView = scope.scrollView;
|
||||
expect(scrollView.options.bouncing).toBe(false);
|
||||
});
|
||||
|
||||
it('Should set start x and y', function() {
|
||||
element = compile('<content start-x="100" start-y="300" has-header="true"></content>')(scope);
|
||||
timeout.flush();
|
||||
var newScope = element.isolateScope();
|
||||
var scrollView = scope.scrollView;
|
||||
var vals = scrollView.getValues();
|
||||
expect(vals.left).toBe(100);
|
||||
expect(vals.top).toBe(300);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -299,6 +299,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
scrollingY: true,
|
||||
scrollbarY: true,
|
||||
|
||||
startX: 0,
|
||||
startY: 0,
|
||||
|
||||
/** The minimum size the scrollbars scale to while scrolling */
|
||||
minScrollbarSizeX: 5,
|
||||
minScrollbarSizeY: 5,
|
||||
@@ -378,6 +381,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
});
|
||||
};
|
||||
|
||||
this.__scrollLeft = this.options.startX;
|
||||
this.__scrollTop = this.options.startY;
|
||||
|
||||
// Get the render update function, initialize event handlers,
|
||||
// and calculate the size of the scroll container
|
||||
this.__callback = this.getRenderFn();
|
||||
|
||||
Reference in New Issue
Block a user