hpi-swa-teaching / SketchMorph2

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

Feature/30 brush size #62

Closed maximilian-franz closed 3 years ago

maximilian-franz commented 3 years ago

Closes #30

kpostnov commented 3 years ago

The tests are well done. I suggest we add one more test which asserts the pencil (and geometric forms) remains as it is when changing the brush size.

kpostnov commented 3 years ago

On further thought, it might make sense to make the eraser adjustable as well even though it's not part of the user story. Then we would have to inform the customer about this.

DevSchmidtchen commented 3 years ago

We noticed that

On further thought, it might make sense to make the eraser adjustable as well even though it's not part of the user story. Then we would have to inform the customer about this.

We actually noticed, that the eraser size is indeed part of the User Story, but the necessary changes are only very few (I am actually going to implement them right now 🤓)

kpostnov commented 3 years ago

Even though the circle brush works well, the triangle and rectangle brush have an unwanted offset now.

DevSchmidtchen commented 3 years ago

Even though the circle brush works well, the triangle and rectangle brush have an unwanted offset now.

UPDATE: Fixed it (hopefully)!

Well, that was probably the reason for the penNibOffset 😅

Calculation: (self sourceForm extent / 2) floor

drawRectangle
    self isErasing: false.
    self pen sourceForm: ((Form extent: self rectangleBrushSize) fillBlack).
    self mode: #pen.
    self currentTool: #drawRectangle
drawTriangle
    self isErasing: false.
    self pen sourceForm: self prepareTrianglePenSource.
    self mode: #pen.
    self currentTool: #drawTriangle
prepareTrianglePenSource
    | triangleForm temporaryPen |
    triangleForm := Form extent: self brushSize asPoint.
    temporaryPen := (Pen newOnForm: triangleForm) 
        place: 0 @ (self brushSize - 1); 
        turn: 90;
        yourself.

    1 to: 3 do: [:i | temporaryPen go: self brushSize; turn: -120].

    triangleForm convexShapeFill: Color black.
    ^ triangleForm
ClFeSc commented 3 years ago

Regardless of the name of the class, it should have a description.