hpi-swa-teaching / SketchMorph2

(SWT22-06)
MIT License
5 stars 1 forks source link

Add anchor at bottom right of canvas. #59

Closed kpostnov closed 3 years ago

kpostnov commented 3 years ago

Close #57.

ClFeSc commented 3 years ago

In M2GripMorph>>updatePosition, we currently have

updatePosition
    self position: self target position
        + self target extent
        - self extent

We could use

updatePosition
    self position: self target position
        + self target extent
        - self extent
        + 4 asPoint

instead. With this, the blue bracket would be outside of the canvas. We can also use 5 asPoint, which would result in a small gap between the canvas and the bracket, but would also make it more difficult to move the grip morph of the window. What do you think?

DevSchmidtchen commented 3 years ago

Personally, I think that it should not be possible to drag the anchor out of the application window.

By changing the position in mouseMove: to self position: ((evt position + self cursorOffset) min: (self target position + self target maximumSize)). it's only possible to drag the anchor a little bit out of the window.

ClFeSc commented 3 years ago

Personally, I think that it should not be possible to drag the anchor out of the application window.

By changing the position in mouseMove: to self position: ((evt position + self cursorOffset) min: (self target position + self target maximumSize)). it's only possible to drag the anchor a little bit out of the window.

Maybe we could hide the anchor when moving? Then you have the rectangle showing the new size of the canvas.

maximilian-franz commented 3 years ago

Personally, I think that it should not be possible to drag the anchor out of the application window.

By changing the position in mouseMove: to self position: ((evt position + self cursorOffset) min: (self target position + self target maximumSize)). it's only possible to drag the anchor a little bit out of the window.

By changing it to

self position: (((evt position + self cursorOffset)
    max: self target position)
    min: (self target position + self target maximumSize))
    - self extent

the anchor would be fully confined to the application window.

Edit: I just noticed that this sometimes causes the cursor to not change back to default, which is weird. I don't know why that is, though. This seems to be an issue caused by squeak. Therefore, I think we should implement this.

ClFeSc commented 3 years ago

Edit: I just noticed that this sometimes causes the cursor to not change back to default, which is weird. I don't know why that is, though.

@maximilian-franz I think this is a Squeak bug when you move the cursor to somewhere where the object you were dragging can't follow you due to restrictions like we used here. This goes as far as to affect system windows like the browser. I don't think we should care about this.

kpostnov commented 3 years ago

Currently, the minimum size of the canvas is the size of the blue handle. I'm not sure if we should ask the customer about this change compared to the current version we showed her.

I don't know what is was like before, but I think it's pretty intuitive to set a canvas minimum size depending on the grip extent. Otherwise there would be a floating handle. In MS Paint it's handled even worse: The minimum canvas size is 1px which leads to the grip becoming too small to grab.

ClFeSc commented 3 years ago

Currently, the minimum size of the canvas is the size of the blue handle. I'm not sure if we should ask the customer about this change compared to the current version we showed her.

I don't know what is was like before, but I think it's pretty intuitive to set a canvas minimum size depending on the grip extent. Otherwise there would be a floating handle. In MS Paint it's handled even worse: The minimum canvas size is 1px which leads to the grip becoming too small to grab.

In the current dev implementation, you can minimize the canvas to effectively 0x0 pixels. You are then still able to drag it again, making the canvas not useless when it's so small. I think it would be good to describe the situation to her and ask her if she would be happy with the changes this PR makes.