GoogleChromeLabs / ProjectVisBug

FireBug for designers › Edit any webpage, in any state https://a.nerdy.dev/gimme-visbug
https://visbug.web.app
Apache License 2.0
5.47k stars 287 forks source link

add support for resizing elements #569

Closed mayank99 closed 2 years ago

mayank99 commented 2 years ago

Closes #17

Order of events is as follows:

  1. pointerdown on visbug-handle triggers on_element_resize_start
    • this saves the initial state of the resizing
    • adds listeners for pointermove and pointerup on document
  2. pointermove on document triggers on_element_resize_move
    • this is where the resizing is calculated and triggered via requestAnimationFrame
  3. pointerup on document triggers on_element_resize_end
    • this is where we detach the pointermove listener
    • also restore any original styles that we modified for the resize (e.g. cursor and transition)

Screen recording showing a demo of resizing various elements

google-cla[bot] commented 2 years ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

argyleink commented 2 years ago

everyone will get the update within the hour! thank you for this, it's raddddd!

mayank99 commented 2 years ago

thanks for the lovely comments and for accepting the contribution 💜

the process was mostly smooth, but i couldn't get dev:extension to work on windows (it uses cp) so i only tested in the local dev environment

i did notice some transform drift when resizing from the top? i think it's acceptable given the illusion working so well. the handles don't drift is what i mean, and i think that was a good choice and this is an ok side effect.

yeah... i noticed that this issue happens only on some elements but not others. i could not figure out why, it might have something to do with the layout?

argyleink commented 2 years ago

i couldn't get dev:extension to work on windows (it uses cp) so i only tested in the local dev environment

i was wondering if you'd tried loading the extension unpacked..! i'm sad that cp prevented that, sorry about that! there's certainly some infra updates that could be done in the codebase to smooth out cross platform and cross IDE dev. need to block out some maintenance time. also need to update to manifest v3. thanks for letting me know tho! want to log a bug about it?

p.s. looks like auto publishing github action stopped working, just manually uploaded