Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[core] fix render list gap problem (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
yxping authored and YorkShen committed Sep 25, 2018
1 parent 82fc91c commit cd89a4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected MeasureOutput measure(int width, int height) {
int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
int weexH = WXViewUtils.getWeexHeight(getInstanceId());
int outHeight = height > (weexH >= screenH ? screenH : weexH) ? weexH - getAbsoluteY() : height;
return super.measure((int)(width+mColumnGap), outHeight);
return super.measure(width, outHeight);
}

public int getOrientation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ protected MeasureOutput measure(int width, int height) {
int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
int weexH = WXViewUtils.getWeexHeight(getInstanceId());
int outHeight = height > (weexH >= screenH ? screenH : weexH) ? weexH - getAbsoluteY() : height;
return super.measure((int)(width+mColumnGap), outHeight);
return super.measure(width, outHeight);
}


Expand Down
14 changes: 9 additions & 5 deletions weex_core/Source/core/render/node/render_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ void RenderList::PreCalculateCellWidth() {

std::string RenderList::CalculateSpanOffset() {
std::string span_offsets;
if (this->left_gap_ > 0 || this->right_gap_ > 0) {
float divide = available_width_ / column_count_;
float item_start_pos = 0;
if (this->left_gap_ > 0 || this->right_gap_ > 0 || column_gap_ > 0) {
span_offsets.append("[");
for (int i = 0; i < this->column_count_; i++) {
float span_offset =
this->left_gap_ + i * ((this->column_width_ + this->column_gap_) -
(this->available_width_ + this->column_gap_) /
this->column_count_);
if (i == 0) {
item_start_pos += left_gap_;
} else {
item_start_pos += column_gap_ + column_width_;
}
float span_offset = item_start_pos - i * divide;
span_offsets.append(to_string(span_offset));
if (i != this->column_count_ - 1) {
span_offsets.append(",");
Expand Down

0 comments on commit cd89a4d

Please sign in to comment.