-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix for p5.Element.prototype.position not applying styling properly #3448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think in the case of Also |
|
As referred to in #3447, it does seem to be strange behaviour for p5.Element.prototype.style = function(prop, val) {
var self = this;
// ...
if (typeof val === 'undefined') {
// ...
} else {
if (prop === 'rotate' || prop === 'translate' || prop === 'position') {
var trans = Array.prototype.shift.apply(arguments);
var f = this[trans] || this['_' + trans];
f.apply(this, arguments);
} else {
// ...
}
}
return this;
};and so its really the application of position style here that needs the fix in that case. Happy to make the alteration here instead? Would certainly cause less confusion if |
|
@nebbles @limzykenneth , I agree that the position function should not be overloaded , but in my humble opinion, it would be nice to see if it supported other position attributes instead of only being restricted to "absolute" The use case of other properties may arise when the canvas may be present inside another div,
with default value being absolute. Waiting for your thoughts about it , |
|
@Ajayneethikannan I think the proposal of something like |
|
I have opened a new issue for discussion at #3570 . |
Proposed fix for #3447 where
p5.Element.prototype.positionof p5.dom does not style the element properly as called by e.g.style('position','fixed').As seen in issue, the problem stems from
p5.Element.prototype.stylehowever, it seems that the design of this function is to delegate the assignment of transformations to their respective functions.As such
p5.Element.prototype.positionwas modified to be able to handle all cases, explicitly ensuring only valid values for CSSpositionare used.This is my first PR so hopefully checked all the boxes 🤞