Roassal3 icon indicating copy to clipboard operation
Roassal3 copied to clipboard

Modify camera reference point

Open bergel opened this issue 4 years ago • 3 comments

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

bergel avatar May 04 '20 15:05 bergel

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.

bergel avatar May 12 '20 01:05 bergel

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

akevalion avatar May 12 '20 01:05 akevalion

Related issues https://github.com/ObjectProfile/Roassal3/issues/463 https://github.com/ObjectProfile/Roassal3/issues/181

akevalion avatar Oct 14 '22 14:10 akevalion

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
image

But if you comment canvas originTopLeft

image

akevalion avatar May 30 '23 11:05 akevalion