RSTreeMap does not computes the area correctly
akevalion opened this issue · comments
The problem is that extent: and extent does not work like the same. Dirty rectangles changes the way to compute the base rectangle for bounding shapes with borders, then extent:
should do the same
consider
box := RSBox new.
box borderWidth: 10.
box extent: 50@50. "now the extent of the box with the border should be 50@50."
box extent: 0@0. "The extent now is 10@10"
Now this is fixed
| b labels |
b := RSTreeMap new.
b boxShape
@ RSDraggable;
@ (RSLabeled new
in: [ :lbl | lbl location middle ];
yourself).
labels := (1 to: 100) collect: #asString.
b boxShape color: Color veryLightGray.
b from: labels using: [ #() ].
b modelWeight: [ :n | n size ].
b build.
^ b canvas
![image](https://private-user-images.githubusercontent.com/10532890/280742210-23a72e96-e2f7-4406-897c-58d1569f2556.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMDQ5MjgsIm5iZiI6MTcyNDMwNDYyOCwicGF0aCI6Ii8xMDUzMjg5MC8yODA3NDIyMTAtMjNhNzJlOTYtZTJmNy00NDA2LTg5N2MtNThkMTU2OWYyNTU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDA1MzAyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMyODI0ZmU4Njc2ZGMxZmNiMTc4MTE3M2U0Yzk3MjJhOWY0MjE1Y2UxODlhNTA1YWUwMzhiNThmNjViMWJlNzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Ad86ugP3mU0pWP_6sZzXFOohSjISLVW0tpGcOzUSCjo)
Note: the treemap works better with b boxShape noBorder
.
![image](https://private-user-images.githubusercontent.com/10532890/280743369-b6b97090-d16d-4134-aeac-a6499d93381f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMDQ5MjgsIm5iZiI6MTcyNDMwNDYyOCwicGF0aCI6Ii8xMDUzMjg5MC8yODA3NDMzNjktYjZiOTcwOTAtZDE2ZC00MTM0LWFlYWMtYTY0OTlkOTMzODFmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDA1MzAyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTliOTI3MmI1Y2ZlYWY2YzY1MzkzYmUzYmU5YmRjNDEyMTE0Yjc3NWExOGI1Y2JkODNmYTQyZTQxZTU5MjBlNzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ofCG52qWfXlB8w7n3zxKMWxWjMU9YdiiSAQWAGTPdqU)
...
b build.
b shapes do: [ :s | s borderColor: Color black ].
^ b canvas
![image](https://private-user-images.githubusercontent.com/10532890/280743896-fb1a205a-0c1a-4d0e-bdc5-5c37356e80e4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMDQ5MjgsIm5iZiI6MTcyNDMwNDYyOCwicGF0aCI6Ii8xMDUzMjg5MC8yODA3NDM4OTYtZmIxYTIwNWEtMGMxYS00ZDBlLWJkYzUtNWMzNzM1NmU4MGU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDA1MzAyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEyOThiYWU3MzI4ODY1YzhkNDlhM2MyYzYwNmY3ODU5ODI5YzZmOGVlZTljODI5ZGRhNzBkNThjNDYzOGYyMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MY_hi5jzuxeWYZ0MpuCE7rEXvmuLo1d_-3LzCpkKj0s)