forked from processing-js/processing-js
-
Notifications
You must be signed in to change notification settings - Fork 10
size() bug
edorfaus edited this page Sep 12, 2010
·
1 revision
There seems to be a bug in the size() method of processing.js. It resets the line width when it is called (or more accurately, doesn’t preserve it like it does for the fill and stroke colors).
This can be seen by taking the basic example from the front page, starting it, and then changing the size dynamically – the circle border becomes much thinner.
FIX: Add two lines to the size method, preserving the lineWidth of the current context:
p.size = function size( aWidth, aHeight ) { var fillStyle = curContext.fillStyle; var strokeStyle = curContext.strokeStyle; var lineWidth = curContext.lineWidth;
curElement.width = p.width = aWidth; curElement.height = p.height = aHeight;
curContext.fillStyle = fillStyle; curContext.strokeStyle = strokeStyle; curContext.lineWidth = lineWidth; };