cmajor-lang/cmajor

Is it possible to resize with a fixed aspect ratio?

Tanchiky opened this issue · 2 comments

Is there any way to fix the aspect ratio in cmajor, I have looked at various documents, sources, etc. for the view item in patch file, but have not found anything specific.
(something like setFixedAspectRatio in JUCE)

To make it easy to rescale a view without changing its aspect ratio, you can add this method to your view web component class:

e.g.

    getScaleFactorLimits()
    {
        return { minScale: 0.50,
                 maxScale: 1.25 };
    }

We've got some internal examples that use this, and will publish one soon.. But you can see the code that does the work here: https://github.com/SoundStacks/cmajor/blob/b44d5bc6a03cd67589d4f9709e958734b825a359/include/cmajor/helpers/cmaj_PatchWebView.h#L221

Thank you! This worked out well!