-
Notifications
You must be signed in to change notification settings - Fork 290
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
add support for resizing elements #569
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall i saw no issues with the new feature 🤘🏻
the local dev website rocks, and it performed super well on all sorts of live websites.
it was super fun! this should land awesomely!
there's a couple little suggestions in review comments, but nothing major.
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.
any closing thoughts for you before this merges and you contribute a rad feature?
grid-area: 1 / -1; | ||
place-self: var(--align-self, center) var(--justify-self, center); | ||
transform: translate(var(--translate-x, 0), var(--translate-y, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love this ❤️
background-color: white; | ||
border: 1px solid hotpink; | ||
padding: 0; | ||
width: 0.5rem; | ||
height: 0.5rem; | ||
border-radius: 50%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx for stickin close to the original style while updating it to something interactive 👍🏻
aka, nice intuitive design decisions here
position: relative; | ||
cursor: var(--cursor); | ||
|
||
/* increase tap target size */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i noticed this UX and went looking for what you did! rad inset style yo
} | ||
} | ||
|
||
:host([placement^="top"]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they tweeted about you 😉 https://twitter.com/devongovett/status/1576635415024390144?s=20&t=H_wzo5sqqz0BKfhHEQ3O1w
|
||
connectedCallback() { | ||
this.$shadow.adoptedStyleSheets = this.styles | ||
this.$shadow.innerHTML = this.render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.$shadow.innerHTML = this.render(); | |
this.$shadow.innerHTML = this.render() |
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b1c9084. I also noticed that the project uses spaces everywhere, whereas my IDE default is tabs so fixed that too.
Might help to set up prettier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theres an editor config, but not everyone has that plugin installed
this.$shadow.innerHTML = this.render(); | ||
|
||
this.button = this.$shadow.querySelector('button') | ||
this.button.addEventListener('pointerdown', this.on_element_resize_start.bind(this)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i bet this'll work with touch because of this choice 👍🏻
should be fine to try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont have a touch device (that supports browser extensions) to try this but yeah that's the idea behind using pointerdown
vs mousedown
i think there are additional optimizations that can be made in touch events that are not available in pointer events. one example is the touches
to prevent unexpected behavior when using gestures.
but the code is much simpler with pointerdown
🤷
requestAnimationFrame(() => { | ||
sourceEl.style.width = `${newWidth}px` | ||
sourceEl.style.height = `${newHeight}px` | ||
sourceEl.style.transform = `translate(${newTranslate.x}px, ${newTranslate.y}px)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very clever to transform here! awesome UX attention to detail here, really sells the illusion. the same technique would probably support margin and padding visuals being grab-able 🤔
also cool you used the DOMMatrix to do the math 🤘🏻
not two things i would have reached for immediately, but find they totally rock for this scenario. cool math and programming plus a great user experience. 😍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jake deserves the credit for DOMMatrix
😄 https://youtu.be/VdNzD4lhidw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was wonderin!!! seemed like appropriate timing
everyone will get the update within the hour! |
thanks for the lovely comments and for accepting the contribution 💜 the process was mostly smooth, but i couldn't get
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? |
i was wondering if you'd tried loading the extension unpacked..! i'm sad that p.s. |
Closes #17
visbug-handles
to the newvisbug-handle
element.handle-css
andHandleStyles
and added new singular ones for the elementplacement
. e.g.<visbug-handle placement="top-end">
.Order of events is as follows:
on_element_resize_start
on_element_resize_move
on_element_resize_end