Resizing card near page end should increase page size

See title^ —————- ignore these extra characters I have to type cuz of this annoying forum software

1 Like

I don’t know where to start with this one.

I understand that cards can be resized when dragging the bottom-right corner. Does that mean that the page size should grow horizontally to the right? What is the page size here? The size of a Kinopio space or the literal browser page?

The page size is dynamically defined in updatePageSizes in store.js, it’s either the viewport (the natural page size) or the based on the size of the combined cards and boxes (aka items) in the space (+ some padding).

I believe the way it works is you just call store.dispatch('updatePageSizes') whenever you want the page size to be recalculated.

so the root cause for this is that when the card (and/or box) resize is ended, updatePageSizes isn’t being called. Ensuring that it’s called should hopefully fix this

I am confused.

In Space.vue There is stopResizingCards() and stopResizingBoxes(). The box version calls store.dispatch('checkIfItemShouldIncreasePageSize', box), but the card one doesn’t. A problem with checkIfItemShouldIncreasePageSize seems to be that it uses width and height and not resizeWidth and resizeHeight, which means it doesn’t always correctly resize the page size after resizing.

Both, stopResizingCards() and stopResizingBoxes() get called in stopInteractions(), which gets called on the mouseup event.

In addition, there is the updatePageSizes action you mentioned. This one gets called in Space.vue from updatePageSizeFromMutation(), which gets called when the user starts/stops dragging/resizing cards/boxes, which works reliable while I was testing.

Would it be possible to get rid of one of those ways to calculate the page size and instead use a unified method to calculate it? Like utils.pageSizeFromItems(items)

I don’t know where the bug is yet, and having 2 ways of doing this thing could be more confusing in the future. I also learned that the automatic page resizing already works at least sometimes for both cards and boxes.

Yes I think unifying them makes sense. Boxes existed well after cards so that’s probably why there’s two. One wrinkle to factor in is that cards have height and width and optional resizewidth (because cards have implicit sizes and may or may not be manually resized), and boxes only have resizewidth and resizeheight because they must be manually sized.

Usually I just do something like

width = resizewidth || width

There may also be a util method for this you can use

i need to refactor this anyways as part of the drawing feature so i’ll take this over.

fix released

2 Likes