Emit @resized whenever pixel width/height changes #337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now,
@resized
was only emitted when the user "manually" resized the griditems. Not if e.g. the user changes the width the window, which causes w and h to stay
the same, but the width in pixels changes.
With this commit, all changes to GridItem-s that cause width and
height to change (in pixles) also cause
@resized
to be emitted.About Whether to
$emit('resized'....)
or Some Other Event NameHere I'm re-using the
@resized
event name, because it is actually an event that occurs when the GridItem resizes in pixels.But I understand the counter-argument that says: This should be a different event, because it doesn't occur when the user resizes a GridItem (with the mouse) but when the GridItem resize indirectly, e.g. because of a window resize.The doc for the existing resize event is:
In my opinion that is ambiguous and could be read either way. And I decided that since
newHPx
andnewWPx
changes, emitting a@resized
event is appropriate. It does mean that current listeners for the@resized
event will get events under more circumstances than today, though.We could also add an extra parameter to the event, e.g.
draggedResize
which istrue
orfalse
so event recipients can determine whether the cause was a drag operation or an indirect operation.If the general consensus is for another event name, I'll change the name of the event. What made me abandon this approach was that I couldn't come up with a better name for the event.