|
|
@@ -135,6 +135,13 @@ export default class TableView extends cc.Component {
|
|
|
if (this.isHideAllChild) this.isHideAllChild = false;
|
|
|
this.scrollView.node.on('scrolling', this.callback, this);
|
|
|
// cc.log('tableView结束:' + this.testTime());
|
|
|
+
|
|
|
+ //水平居中
|
|
|
+ if (this.direction == Direction.horizontal) {
|
|
|
+ if (this.content.width < this.layerWith) {
|
|
|
+ this.node.x = (this.layerWith - this.content.width) * 0.5;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -324,7 +331,14 @@ export default class TableView extends cc.Component {
|
|
|
* @param num
|
|
|
*/
|
|
|
private updateContentHeigh(num: number) {
|
|
|
- this.content.height = num > this.layerHeight ? num : this.layerHeight;
|
|
|
+ // this.content.height = num > this.layerHeight ? num : this.layerHeight;
|
|
|
+ this.content.height = num;
|
|
|
+ if (this.content.height <= this.layerHeight) {
|
|
|
+ this.scrollView.vertical = false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.scrollView.vertical = true;
|
|
|
+ }
|
|
|
// cc.log('滚动条高度:', this.content.height);
|
|
|
}
|
|
|
|
|
|
@@ -333,7 +347,14 @@ export default class TableView extends cc.Component {
|
|
|
* @param num
|
|
|
*/
|
|
|
private updateContentWidth(num: number) {
|
|
|
- this.content.width = num > this.layerWith ? num : this.layerWith;
|
|
|
+ // this.content.width = num > this.layerWith ? num : this.layerWith;
|
|
|
+ this.content.width = num;
|
|
|
+ if (this.content.width <= this.layerWith) {
|
|
|
+ this.scrollView.horizontal = false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.scrollView.horizontal = true;
|
|
|
+ }
|
|
|
// cc.log('滚动条高度:', this.content.height);
|
|
|
}
|
|
|
|