You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to access the position of a slider and noticed that only the property slider.width and slider.heigh are accessible.
I manage to get the relative positions through slider.elt.style.left or slider.elt.style.top .
Wouldn't be nice to have access straight from the element like slider.xslider.y? Perhaps with center mode or corner mode.
Going to close this one because we decided against storing the position in xy on the Element since any changes to position in css made without using p5 would break those attributes. However, position() with null args will soon return an object with x and y.
Same thing applies to width and height attrs but we need those for the canvas, but if you wanted always accurate measurements size() will soon return them in an object .
@lmccart is it worth making width and height private to improve p5 integrity? I wonder if there are examples or tutorials that would break though.
It will certainly break a ton of examples, and also working code. Would it be a terrible idea to hook into the window resize event, and check-and-update canvas sizes when that happens?
@workergnome are you confusing the global width and height variables for the p5.Element ones? I don't believe the latter appear in many examples (and are unrelated to a resize() event? Apologies if I'm the one misunderstanding!
Activity
futuremarc commentedon Jun 20, 2015
Going to close this one because we decided against storing the position in
xyon the Element since any changes to position in css made without using p5 would break those attributes. However,position()with null args will soon return an object withxandy.Same thing applies to
widthandheightattrs but we need those for the canvas, but if you wanted always accurate measurementssize()will soon return them in an object .@lmccart is it worth making width and height private to improve p5 integrity? I wonder if there are examples or tutorials that would break though.
radames commentedon Jun 20, 2015
it makes sense! great!
workergnome commentedon Jun 21, 2015
It will certainly break a ton of examples, and also working code. Would it be a terrible idea to hook into the window
resizeevent, and check-and-update canvas sizes when that happens?futuremarc commentedon Jun 22, 2015
@lmccart is this something we should try to address?
shiffman commentedon Jun 22, 2015
@workergnome are you confusing the global
widthandheightvariables for thep5.Elementones? I don't believe the latter appear in many examples (and are unrelated to aresize()event? Apologies if I'm the one misunderstanding!workergnome commentedon Jun 23, 2015
Oops—I am in fact confusing those! Thank you for the clarification.