Is there a maximum length for juce::Line?

I’m having a strange issue, where I just want to draw a line, and it seems the line has a limit of how long it can be.

There’s not a whole lot to see here, but this is the code I have (altered slightly to be one function):

void LfoLine::paint(juce::Graphics &g)
    float x0 = 10.0f;
    float y0 = 10.0f;
    float x1 = 100.0f;
    float y1 = 10.0f;
    mLine.setStart(x0, y0);
    mLine.setEnd( x1, y0 );
    g.drawLine(mLine, 5.0f);

This does draw a line, but it needs to be longer. I also don’t think x1 is getting to 100. If I try float x1 = 600.0f, it doesn’t get any longer.

I don’t know, maybe there is something I’m missing here. I just want a line that can get to 200 or 300. Is there another function I should be using to draw a line? I referenced the tutorial [0] and looked through the source, and I can’t find any reference that would place a limit on line length.

[0] JUCE: Tutorial: The Point, Line, and Rectangle classes

How big is the component that is being drawn into? The size of the graphics context is constrained to the size of the component doing the drawing. It sounds like the component may have a width of around 100, which is why the line is being truncated.

1 Like

Ah… yes, I made a mistake with that.

Thank you.