mgraphics set_line_width madness
For some reason, set_line_width isn't working in jsui/mgraphics. I'm updating the line width based on the mouse position. If I post the value (or call get_line_width) to the Max window, I see values I would expect to see (example :jsui: 21.70 22.35 23.15 23.50 23.70 23.80 24.20 ), but all I get are lines 1 pixel thick (see attached image for demo).
The code is below. Any help would be appreciated. Javascript is still a foreign beast to me.
autowatch =1;
var width = 550;
var height = 550;
var mouseX = 0;
var mouseY = 0;
mgraphics.init();
mgraphics.relative_coords = 0;
function paint(){
mgraphics.set_source_rgba(1, 1, 1, 1);
mgraphics.paint();
var circleRes = 2+ (80 - 2)*((mouseY -0)/ (height-0));
var rad = mouseX-width/2 + .5;
var angle = (Math.PI*2)/circleRes;
var wide = mouseY/20;
mgraphics.translate(width/2, height/2);
mgraphics.set_source_rgb(0,0, 0,0);
mgraphics.set_line_cap("square");
mgraphics.set_line_width(wide);
for(var i=0;i
Solved my own issue. I needed to add
mgraphics.stroke_preserve( );
in the for loop that drew the lines.
Hi all, puzzling over a similar problem. I'm trying to make a simple mouse drawing tool with mgraphics but when I change set_line_width I get these furry caterpillar lines. I love them but I was hoping for a smoother option.
Here's my simple setup, adapted from the help file.
I don't really know javascript, I'd also be curious to know if it would be necessary here. I've seen it used in the jsui context but I'm trying to assess if that rabbit hole is necessary here.
Thanks for any advice

This looks like an artifact that results from drawing very short lines