Roassal3
Roassal3 copied to clipboard
Modify camera reference point
From Pavel (https://discordapp.com/channels/223421264751099906/300020095844089856/706861092617322588):
it would be actually nice to have an option to modify camera reference point now it is the center for some applications, it is more handy to have it as top-left or bottom-left corner
I tried to create a subclass of RSCamera
, in which I defined I modified fromPixelToSpace:
and fromSpaceToPixel:
c := RSCanvas new.
c camera: RSInversedCamera new.
point := RSEllipse new size: 10.
c add: point.
point @ (RSLabeled new text: '100@100').
point translateTo: 100 @ 100.
point := RSEllipse new size: 10.
c add: point.
point @ (RSLabeled new text: '0@0').
c
But it just crashed. No idea why.
Try to test a lot fromPixelToSpace:
because it is a core method that we use a lot.
By other hand I think that we need in roassal something like
""
RSCordinateSystem topLeft."center;bottomLeft"
canvas := RSCanvas new.
"RSCordinateSystem affect to the box manage system"
box := RSBox new position:100@100; size: 100.
canvas
It is an idea, I agree with the new camera subclasses, to modify the canvas camera position But this can affect RSCanvasController
Related issues https://github.com/ObjectProfile/Roassal3/issues/463 https://github.com/ObjectProfile/Roassal3/issues/181
This issue is completed you have
| canvas |
canvas := RSCanvas new.
canvas background: 'veryVeryLightGray'.
canvas originCenterMiddle.
canvas originTopLeft.
canvas add: (RSEllipse new
position: 0@0;
extent: 10@10;
borderColor: 'black';
model: 'origin';
color: 'red';
yourself).
canvas add: (RSBox new
position: 200@200;
extent: 200@200;
borderColor: 'black';
model: 'white';
fill: 255;
yourself).
canvas add: (RSBox new
position: 200@200;
extent: 100@100;
borderColor: 'black';
model: 'gray';
fill: 100;
yourself).
canvas shapes @ RSPopup.
^ canvas
But if you comment canvas originTopLeft