Mimic shadertoy in WebGL
I did not go into much detail with your code but the first thing that comes to mind is that you are rendering with respect to the resolution passed into the shader.

vec2 uv = fragCoord.xy/iResolution.xy;


hope this helps.

Maybe calculate the aspect ratio?

float aspect = float(iResolution.x) / float(iResolution.y ? iResolution.y: 1);