[Pharo-dev] [bloc] shape size?
tudor at tudorgirba.com
Sat Apr 2 18:57:36 EDT 2016
> On Apr 3, 2016, at 12:46 AM, Aliaksei Syrel <alex.syrel at gmail.com> wrote:
> I'm pretty sure we don't understand a meaning of composition identically. This is how I understand it:
> "In graphic design for press and desktop publishing composition is commonly referred to as page layout."
> Design for press is inspiration of modern ui design techniques, for example material design.
> Concentrate on "page layout". Then comes the following question: if composition is archived through layout of elements why Stef tries to manually draw shapes instead of composing two elements?
> 1) Create an element with rectangle shape.
> 2) Create an element with circle shape.
> 3) Add circle element to rectangle element.
> 4) Change layout params of the circle element to match parent both vertically and horizontally
> 5) if needed set padding/margin.
> There is even no need to care about drawing if it's complicated.
That is exactly the point :).
I think for such scenarios we should encourage people to use composition of elements. I think that Stef has a use case of the way the element should look like in the end, and he wants to get it done, and I think we should provide examples that guide him to what the best route should be.
Anyway, this probably reveals the miscommunication.
@Stef: did you want to necessarily play with the low level drawing, or do you just want to get to an element with a rectangle that has a circle inside?
> On Apr 3, 2016 12:26 AM, "Tudor Girba" <tudor at tudorgirba.com> wrote:
> Hi Alex,
> I think that Stef is looking for a composition example. Could you please provide an example that is more canonical and shows the composition of two elements instead of playing with both drawOnSpartaCanvas and the shape?
> > On Apr 2, 2016, at 8:17 PM, Aliaksei Syrel <alex.syrel at gmail.com> wrote:
> > How to make square element with filled circle inside:
> > 1) Subclass BlElement -> BlCell
> > 2) Override
> > drawOnSpartaCanvas: aCanvas
> > super drawOnSpartaCanvas: aCanvas.
> > aCanvas
> > setShape: self localBounds;
> > setStrokePaint: Color blue;
> > stroke
> > 3) Override initialize to have circle shape:
> > initialize
> > super initialize.
> > self shapeDo: [ :aShape | aShape
> > path: BlCirclePath new;
> > fillPaint: Color red ].
> > 4) Open cell in word
> > Easy :)
> "We can create beautiful models in a vacuum.
> But, to get them effective we have to deal with the inconvenience of reality."
"Innovation comes in the least expected form.
That is, if it is expected, it already happened."
More information about the Pharo-dev