Simplify some code
This commit is contained in:
parent
809b2eeee1
commit
2b0b32c030
2 changed files with 3 additions and 8 deletions
|
@ -143,14 +143,10 @@ pub const Output = struct {
|
||||||
self.arrangeLayers();
|
self.arrangeLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn arrange(self: *Self) void {
|
|
||||||
self.arrangeViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Arrange all views on the output for the current layout. Modifies only
|
/// Arrange all views on the output for the current layout. Modifies only
|
||||||
/// pending state, the changes are not appplied until a transaction is started
|
/// pending state, the changes are not appplied until a transaction is started
|
||||||
/// and completed.
|
/// and completed.
|
||||||
fn arrangeViews(self: *Self) void {
|
pub fn arrangeViews(self: *Self) void {
|
||||||
// If the output has a zero dimension, trying to arrange would cause
|
// If the output has a zero dimension, trying to arrange would cause
|
||||||
// underflow and is pointless anyway
|
// underflow and is pointless anyway
|
||||||
if (self.usable_box.width == 0 or self.usable_box.height == 0) {
|
if (self.usable_box.width == 0 or self.usable_box.height == 0) {
|
||||||
|
|
|
@ -86,9 +86,8 @@ pub const Root = struct {
|
||||||
/// Arrange all outputs and then a transaction.
|
/// Arrange all outputs and then a transaction.
|
||||||
pub fn arrange(self: *Self) void {
|
pub fn arrange(self: *Self) void {
|
||||||
var it = self.outputs.first;
|
var it = self.outputs.first;
|
||||||
while (it) |node| : (it = node.next) {
|
while (it) |output_node| : (it = output_node.next) {
|
||||||
const output = &node.data;
|
output_node.data.arrangeViews();
|
||||||
output.arrange();
|
|
||||||
}
|
}
|
||||||
self.startTransaction();
|
self.startTransaction();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue