Coordinates problem with Athens and Morphic while coding Hyperion
So I have found some strange problems with my vector editor , Hyperion. Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open. The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph. I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet). My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ? I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph. here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...> if anyone wants to try the code himself the repo is here http://www.smalltalkhub.com/#!/~kilon/Hyperion To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all. Please note that everything is rendered with Athens. Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
Can you try to do something like self changeProportionalLayout before adding the morph ? Ben On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
just tried it, I see no change self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton . On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
Then maybe you should wait an answer from Igor... Ben On 28 Nov 2013, at 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton .
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin <Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
On 28 November 2013 11:01, Benjamin <Benjamin.VanRyseghem.Pharo@gmail.com>wrote:
Then maybe you should wait an answer from Igor...
heh, i can barely help with this infamous morphic layout mess. i only know that if you using proportional layout, then if you want submorphs to be laid down properly, you must use addMorph:fullFrame: instead of just addMorph: Morph>>addMorph: aMorph fullFrame: aLayoutFrame aMorph layoutFrame: aLayoutFrame asLayoutFrame. aMorph hResizing: #spaceFill; vResizing: #spaceFill. self addMorph: aMorph. (or, well, if you don't want your morph to be automagically stretched, try to set only frame (with #layoutFrame:) because the above, as you can see also sets hResizing & vResizing )
Ben
On 28 Nov 2013, at 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton .
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
try: self changeProportionalLayout editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
wow you guys are fast at replying :) I did self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100). I am afraid Igor I still see no change with your code. I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens. just for the record here is the code I use to render the HypEditButton morph render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. shape2 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +15))@((self position y +10)); cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90. ]. ( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1. aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3. On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself.. You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too. btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code: shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ]. "and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape" canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ] by analogy you can cache all static pieces, just do something: shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ] where #constructStaticShapesOn: must answer an array of them. On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote:
wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. shape2 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +15))@((self position y +10)); cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90. ]. ( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it. I knew about translateBy but I did not know about restoreAfter. so thank you. I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this. Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse. On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience. I will most probably move to Roassal too. As always thanks for the help. On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote:
well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote:
wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. shape2 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +15))@((self position y +10)); cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90. ]. ( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Do you have more screenshots of Hyperion? Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin <Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :) On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel <alexandre.bergel@me.com>wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel <alexandre.bergel@me.com
wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0.So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
absolutely, more code mean deeper understanding how to be more dangerous as a coder i dont see any big difficult on the horizon, except the problem I discussed earlier in the list. I need to figure out how to make sure the mouse touches a line. This is necessary for 2 reasons a) when not in edit mode then the mouse by clicking on the line will be able to drag it around b) when in add points mode, clicking on the line will add more control points on the parts of the lines clicked. Another thing that troubles me is how to handle storing vector lines. I could make each line and even each segment into a separate morph. But I am not so sure if that is an overkill. I see also that Roassal stores them as shapes and allows you to add them with the + method. I like that. I am also thinking making my own morph class which will be a lot more lightweight and Athens friendly. Another alternative is to use a database to store all vector information. But overall I think most of functionality I want to cover is already provided by Athens, its just a matter of coding it. On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0.So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
â BezierMorph.st.gz<https://docs.google.com/file/d/0B7dd-52sqS20SW9JMUxZREh1ZkJEc1UwZkNiYy1jbnZn...> ââ Morphic-BezierCurve.st<https://docs.google.com/file/d/0B7dd-52sqS20LW5XV2NwaFpPeEJudFFGZ3ZsZFBxZC0z...> â On 28 November 2013 16:54, kilon alios <kilon.alios@gmail.com> wrote:
absolutely, more code mean deeper understanding how to be more dangerous as a coder
here it is.. it took me some effort to find it, buried under piles of other things. i don't know which one is latest/working, and don't ask me how it works .. it was long ago i was young and sky was blue :) On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0.So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
well I could ask you to give me access to those files , that would be a good start ;) I am so new to this google drive thing On Thu, Nov 28, 2013 at 10:08 PM, Igor Stasenko <siguctua@gmail.com> wrote:
BezierMorph.st.gz<https://docs.google.com/file/d/0B7dd-52sqS20SW9JMUxZREh1ZkJEc1UwZkNiYy1jbnZn...>
Morphic-BezierCurve.st<https://docs.google.com/file/d/0B7dd-52sqS20LW5XV2NwaFpPeEJudFFGZ3ZsZFBxZC0z...>
On 28 November 2013 16:54, kilon alios <kilon.alios@gmail.com> wrote:
absolutely, more code mean deeper understanding how to be more dangerous as a coder
here it is.. it took me some effort to find it, buried under piles of other things. i don't know which one is latest/working, and don't ask me how it works .. it was long ago i was young and sky was blue :)
On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0.So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 28 November 2013 22:49, kilon alios <kilon.alios@gmail.com> wrote:
well I could ask you to give me access to those files , that would be a good start ;)
I am so new to this google drive thing
hehe.. me too.. apperently it doesn't wants to just attach files, and need multiple more clicks to enable weird sharing, like sending a copy is not good enough :)
On Thu, Nov 28, 2013 at 10:08 PM, Igor Stasenko <siguctua@gmail.com>wrote:
BezierMorph.st.gz<https://docs.google.com/file/d/0B7dd-52sqS20SW9JMUxZREh1ZkJEc1UwZkNiYy1jbnZn...>
Morphic-BezierCurve.st<https://docs.google.com/file/d/0B7dd-52sqS20LW5XV2NwaFpPeEJudFFGZ3ZsZFBxZC0z...>
On 28 November 2013 16:54, kilon alios <kilon.alios@gmail.com> wrote:
absolutely, more code mean deeper understanding how to be more dangerous as a coder
here it is.. it took me some effort to find it, buried under piles of other things. i don't know which one is latest/working, and don't ask me how it works .. it was long ago i was young and sky was blue :)
On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0.So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
please note that the button for inserting an image is different to the button for attaching an image. Strange that it does not let you attach files, maybe if you zip, but in any case why dont you make smalltalkhub repo and publish the code there and give me the link to it ? On Fri, Nov 29, 2013 at 6:36 AM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 22:49, kilon alios <kilon.alios@gmail.com> wrote:
well I could ask you to give me access to those files , that would be a good start ;)
I am so new to this google drive thing
hehe.. me too.. apperently it doesn't wants to just attach files, and need multiple more clicks to enable weird sharing, like sending a copy is not good enough :)
On Thu, Nov 28, 2013 at 10:08 PM, Igor Stasenko <siguctua@gmail.com>wrote:
BezierMorph.st.gz<https://docs.google.com/file/d/0B7dd-52sqS20SW9JMUxZREh1ZkJEc1UwZkNiYy1jbnZn...>
Morphic-BezierCurve.st<https://docs.google.com/file/d/0B7dd-52sqS20LW5XV2NwaFpPeEJudFFGZ3ZsZFBxZC0z...>
On 28 November 2013 16:54, kilon alios <kilon.alios@gmail.com> wrote:
absolutely, more code mean deeper understanding how to be more dangerous as a coder
here it is.. it took me some effort to find it, buried under piles of other things. i don't know which one is latest/working, and don't ask me how it works .. it was long ago i was young and sky was blue :)
On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 29 November 2013 09:42, kilon alios <kilon.alios@gmail.com> wrote:
please note that the button for inserting an image is different to the button for attaching an image. Strange that it does not let you attach files, maybe if you zip, but in any case why dont you make smalltalkhub repo and publish the code there and give me the link to it ?
because i don't publish every bit of experimental code i did , only less experimental :) another try, sent you files privately by normal attachment.
On Fri, Nov 29, 2013 at 6:36 AM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 22:49, kilon alios <kilon.alios@gmail.com> wrote:
well I could ask you to give me access to those files , that would be a good start ;)
I am so new to this google drive thing
hehe.. me too.. apperently it doesn't wants to just attach files, and need multiple more clicks to enable weird sharing, like sending a copy is not good enough :)
On Thu, Nov 28, 2013 at 10:08 PM, Igor Stasenko <siguctua@gmail.com>wrote:
BezierMorph.st.gz<https://docs.google.com/file/d/0B7dd-52sqS20SW9JMUxZREh1ZkJEc1UwZkNiYy1jbnZn...>
Morphic-BezierCurve.st<https://docs.google.com/file/d/0B7dd-52sqS20LW5XV2NwaFpPeEJudFFGZ3ZsZFBxZC0z...>
On 28 November 2013 16:54, kilon alios <kilon.alios@gmail.com> wrote:
absolutely, more code mean deeper understanding how to be more dangerous as a coder
here it is.. it took me some effort to find it, buried under piles of other things. i don't know which one is latest/working, and don't ask me how it works .. it was long ago i was young and sky was blue :)
On Thu, Nov 28, 2013 at 4:16 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 13:52, kilon alios <kilon.alios@gmail.com> wrote:
thats all I got I am afraid right now. A simple editing of a straight line, but I am learning athens, roassal, morphic so it takes time. Its my first with everything and my very first project with pharo. I am not aiming for something super sophisticated, bezier lines, gradients, bitmaps etc simple stuff but I am having so much fun with this project I wont give up until I have it finished. :)
btw, if you want, i got somewhere code for Bezier curve editing (in morphic).. it is not fully working, but at least something you can look at: - if i remember you can add control points and move them around.
On Thu, Nov 28, 2013 at 2:30 PM, Alexandre Bergel < alexandre.bergel@me.com> wrote:
Do you have more screenshots of Hyperion?
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 28, 2013, at 7:49 AM, kilon alios <kilon.alios@gmail.com> wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko < siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko < siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
why? Just continue and learn.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com> wrote: well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote: wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ].
shape2 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative .
path moveTo: ((self position x +15))@((self position y +10));
cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90.
].
( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote: just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin <Benjamin.VanRyseghem.Pharo@gmail.com> wrote: Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60 ( 0@0 + 6@30 + 0@30 = 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
"why?" what Stephane ? Continue what ? I did not say I don't want to learn . On Fri, Nov 29, 2013 at 9:52 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
why? Just continue and learn.
As always thanks for the help.
On Thu, Nov 28, 2013 at 12:29 PM, Igor Stasenko <siguctua@gmail.com>wrote:
well, by default the athens canvas coordinate system matches morphic one.. but you know, it always hard to be sure, especially if you perform any local coordinate transformations before that morph has any chance to draw itself..
You can figure this out easily: draw something at 0@0 and see where it is. then draw something at morph's x@y position and see it too.
btw, you know you don't have to create same paths over and over. you can easily put static parts out of regularly (and costly) evaluated code:
shape := canvas cacheAt: self "morph" ifAbsentPut: [ aCanvas createPath: [:path | path relative. " no move-to here *** path moveTo: ((self position x )+5)@(self position y);" lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. ].
"and here we're using coordinate transform to translate origin point to given position, so it will be the starting point (0@0) of our shape"
canvas pathTransform restoreAfter: [ canvas pathTransform translateBy:((self position x )+5)@(self position y). canvas drawShape: shape. ]
by analogy you can cache all static pieces, just do something:
shapes := canvas cacheAt: self ifAbsentPut: [ self constructStaticShapesOn: aCanvas ]
where #constructStaticShapesOn: must answer an array of them.
On 28 November 2013 11:12, kilon alios <kilon.alios@gmail.com> wrote:
wow you guys are fast at replying :)
I did
self changeProportionalLayout. editButton := HypEditButton new . editButton position: 0@0. self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
I am afraid Igor I still see no change with your code.
I like to note here, that when I first created the editButton as morph , it indeed placed it in correct place. A 0@0 placed it in top left corner as expected. But I did overide its DrawOn: with an empty method and used my own method to render it with Athens. So it looks like the problem is Athens related and not Morphic related or maybe a disagreement between Morphic and Athens.
just for the record here is the code I use to render the HypEditButton morph
render:aCanvas |shape1 shape2 shape3 editButtonColor | shape1 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x )+5)@(self position y); lineTo: 20@0; cwArcTo: 5@5 angle: 45; lineTo: 0@20; cwArcTo: (-5)@5 angle: 45; lineTo: (-20)@0; cwArcTo: (-5)@(-5) angle: 45; lineTo: 0@(-20); cwArcTo: 5@(-5) angle: 45. ]. shape2 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +7))@((self position y +3)); lineTo: 18@0; cwArcTo: 2@2 angle: 45; lineTo: 0@20; cwArcTo: (-2)@2 angle: 45; lineTo: (-20)@0; cwArcTo: (-2)@(-2) angle: 45; lineTo: 0@(-20); cwArcTo: 4@(-2) angle: 45. ]. shape3 := aCanvas createPath: [:path | path relative . path moveTo: ((self position x +15))@((self position y +10)); cwArcTo: 5@5 angle: 90; cwArcTo: (-5)@5 angle: 90; cwArcTo: (-5)@(-5) angle: 90; cwArcTo: 5@(-5) angle: 90. ]. ( editMode = true) ifTrue: [ editButtonColor := Color green] ifFalse: [ editButtonColor := Color red ]. (aCanvas setStrokePaint: editButtonColor) width: 1.
aCanvas drawShape: shape1 . aCanvas drawShape: shape2. aCanvas setPaint: (editButtonColor alpha: 0.3 ). aCanvas drawShape: shape3.
On Thu, Nov 28, 2013 at 12:03 PM, Igor Stasenko <siguctua@gmail.com>wrote:
On 28 November 2013 10:59, kilon alios <kilon.alios@gmail.com> wrote:
just tried it, I see no change
try: self changeProportionalLayout
editButton := HypEditButton new . self addMorph: editButton fullFrame: #(0 0 0 0 0 0 100 100).
On Thu, Nov 28, 2013 at 11:54 AM, Benjamin < Benjamin.VanRyseghem.Pharo@gmail.com> wrote:
Can you try to do something like
self changeProportionalLayout before adding the morph ?
Ben
On 28 Nov 2013, at 10:51, kilon alios <kilon.alios@gmail.com> wrote:
So I have found some strange problems with my vector editor , Hyperion.
Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6@30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph.
I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet).
My problem is that when I add that button as morph to the existing morph of Hyperion in 0@0 , it actually appears in 0@30 in local coordinated of the Hyperion moprh which in global coordinates it 6@60( 0@0+ 6@30+ 0@30= 6@60). Why is that ?
I have no clue why I am getting an offset of 0@30 in local coordinates of the Hyperion morph.
here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph Hyperion coordinates problem.JPG<https://docs.google.com/file/d/0B1L74rM985aqVTZleHlmb3RmbWs/edit?usp=drive_w...>
if anyone wants to try the code himself the repo is here
http://www.smalltalkhub.com/#!/~kilon/Hyperion
To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all.
Please note that everything is rendered with Athens.
Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Very true , now I am studying how to import , export and display svg files. Learning never stops and Roassal code is certainly helpful. On Friday, November 29, 2013, wrote:
Stéphane Ducasse wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
why? Just continue and learn.
There is a lot to learn from Roassal :)
So far you cannot import, but only export SVG in Roassal. I know Athens has an SVG importer, but I have faced some problems with it. Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. On Nov 29, 2013, at 2:58 PM, kilon alios <kilon.alios@gmail.com> wrote:
Very true , now I am studying how to import , export and display svg files. Learning never stops and Roassal code is certainly helpful.
On Friday, November 29, 2013, wrote: Stéphane Ducasse wrote:
Ok I have verified and indeed its not an Athens problem. My bad. The position of the morph is reported at 5@30 and the not the correct 0@0. So it looks like Morphic for some strange reason it offsets it.
I knew about translateBy but I did not know about restoreAfter. so thank you.
I prefer my version of the code because it makes clearer what I am trying to do. However ideally because I am drawing a box inside another box the best way would be to follow your approach and scale the second box using one shape instead of two I am currently doing. But thats the price I am paying from not knowing exactly how to do this.
Also trying to painstakingly find the correct transform and scale values requires A LOT of testing . This is why I find a vector editor for Athens and Pharo absolutely essential. No coding can beat designing via mouse.
On the other hand I could use Inkscape and import the svg to Athens , which what I am about to research. Designing all GUI elements by code is a very bad idea, but no less a learning experience.
I will most probably move to Roassal too.
why? Just continue and learn.
There is a lot to learn from Roassal :)
No pb, I think I know how to fix this Alexandre
Le 29-11-2013 à 17:47, Stéphane Ducasse <stephane.ducasse@inria.fr> a écrit :
So far you cannot import, but only export SVG in Roassal. I know Athens has an SVG importer, but I have faced some problems with it.
and do not expect it to be fixed soon. Because we have other priorities.
Stef
On 30 November 2013 02:36, Alexandre Bergel <alexandre.bergel@me.com> wrote:
No pb, I think I know how to fix this
feel free to commit fix to Athens SVG package. Any help is welcome.
Alexandre
Le 29-11-2013 à 17:47, Stéphane Ducasse <stephane.ducasse@inria.fr> a écrit :
So far you cannot import, but only export SVG in Roassal. I know Athens has an SVG importer, but I have faced some problems with it.
and do not expect it to be fixed soon. Because we have other priorities.
Stef
-- Best regards, Igor Stasenko.
participants (6)
-
Alexandre Bergel -
Benjamin -
btc@openinworld.com -
Igor Stasenko -
kilon alios -
Stéphane Ducasse