DVUI

deinit

Parameters

#
self:*AnimateWidget
*AnimateWidget

Source

Implementation

#
pub fn deinit(self: *AnimateWidget) void {
    defer if (dvui.widgetIsAllocated(self)) dvui.widgetFree(self);
    defer self.* = undefined;
    if (self.val) |v| {
        switch (self.init_opts.kind) {
            .none => {},
            .alpha => {
                dvui.alphaSet(self.prev_alpha);
            },
            .vertical => {
                // Negative height messes with layout
                self.data().min_size.h *= @max(v, 0);
            },
            .horizontal => {
                // Negative width messes with layout
                self.data().min_size.w *= @max(v, 0);
            },
        }
    }

    self.data().minSizeSetAndRefresh();
    self.data().minSizeReportToParent();
    dvui.parentReset(self.data().id, self.data().parent);
}