-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from azimgd/multicol
Add masonry layout with multiple column option
- Loading branch information
Showing
15 changed files
with
208 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ DerivedData | |
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
.xcode.env.local | ||
|
||
# Android/IJ | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class Offsetter { | ||
private: | ||
float* offsets; | ||
int columns; | ||
|
||
public: | ||
Offsetter(int numColumns, float headerOffset = 0.0f) : columns(numColumns) { | ||
offsets = new float[columns](); | ||
for (int i = 0; i < columns; ++i) { | ||
offsets[i] = headerOffset; | ||
} | ||
} | ||
|
||
void add(int column, float px) { | ||
if (column >= 0 && column < columns) { | ||
offsets[column] += px; | ||
} | ||
} | ||
|
||
float get(int column) const { | ||
if (column >= 0 && column < columns) { | ||
return offsets[column]; | ||
} | ||
return 0; | ||
} | ||
|
||
float max() const { | ||
if (columns == 0) return 0; | ||
|
||
float maxOffset = offsets[0]; | ||
for (int i = 1; i < columns; ++i) { | ||
if (offsets[i] > maxOffset) { | ||
maxOffset = offsets[i]; | ||
} | ||
} | ||
return maxOffset; | ||
} | ||
|
||
~Offsetter() { | ||
delete[] offsets; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.