Skip to content
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

p5.Element.style() does not correctly update the width, height, left, and top properties if they are changed in the CSS. #5702

Closed
2 of 17 tasks
msed21 opened this issue Jun 30, 2022 · 2 comments · Fixed by #5747

Comments

@msed21
Copy link
Contributor

msed21 commented Jun 30, 2022

Most appropriate sub-area of p5.js?

  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)

p5.js version

1.4.1

Web browser and version

Chrome 103.0.5060.66 (Official Build) (64-bit) (cohort: Stable)

Operating System

Windows 10

Steps to reproduce this

Steps:

  1. Run the following piece of code
  2. Notice the properties do not reflect their actual values.

Snippet:

function setup() {
  createCanvas(800, 800);
  this.testButton = createButton('TEST');
  this.testButton.position(0, 0);

  this.testButton.style('width', '25%');
  this.testButton.style('height', '25%');
  this.testButton.style('left', '50%');
  this.testButton.style('top', '50%');

  console.log(`.width: ${testButton.width} -> actual: ${testButton.elt.offsetWidth} - (CSS 25%)`);
  console.log(`.height: ${testButton.height} -> actual: ${testButton.elt.offsetHeight} - (CSS 25%)`);
  console.log(`.left: ${testButton.left} -> actual: ${testButton.elt.offsetLeft} - (CSS 50%)`);
  console.log(`.right: ${testButton.top} -> actual: ${testButton.elt.offsetTop} - (CSS 50%)`);
}

function draw() {
  background(220);
  fill(0);
}
@msed21 msed21 added the Bug label Jun 30, 2022
@welcome
Copy link

welcome bot commented Jun 30, 2022

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@msed21
Copy link
Contributor Author

msed21 commented Jun 30, 2022

Related to issue #5525

msed21 added a commit to msed21/p5.js that referenced this issue Jun 30, 2022
msed21 added a commit to msed21/p5.js that referenced this issue Jul 1, 2022
@msed21 msed21 mentioned this issue Jul 1, 2022
3 tasks
@msed21 msed21 closed this as completed Jul 1, 2022
@msed21 msed21 reopened this Jul 1, 2022
@msed21 msed21 changed the title p5.Element.style() does not update the width, height, left, and top properties if they are changed in the CSS. p5.Element.style() does not correctly update the width, height, left, and top properties if they are changed in the CSS. Jul 4, 2022
msed21 added a commit to msed21/p5.js that referenced this issue Jul 31, 2022
msed21 added a commit to msed21/p5.js that referenced this issue Jul 31, 2022
@msed21 msed21 mentioned this issue Jul 31, 2022
3 tasks
limzykenneth added a commit that referenced this issue Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants