Skip to content

Commit d0aaf13

Browse files
committedMar 12, 2025·
$mol_plot_map_tiles, separate tile size x, y
1 parent bbac1ac commit d0aaf13

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed
 

‎plot/map/tiles/tiles.view.tree

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ $mol_plot_map_tiles $mol_plot_graph
44
level_pyramid 0
55
tiles_limit 8
66
uri_template \
7-
sub <= tiles /
7+
sub <= tiles /$mol_view
88
Tile* $mol_svg_image
99
style *
1010
transform <= tile_transform* \
1111
uri <= tile_uri* \
1212
pos /
1313
0
1414
0
15-
size /
15+
size <= tile_dims_real /number
1616
<= tile_size_real
1717
<= tile_size_real

‎plot/map/tiles/tiles.view.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ namespace $.$$ {
6666
const [ shift_x, shift_y ] = this.shift()
6767
const [ scale_x, scale_y ] = this.scale()
6868
const count = 1 << level
69-
const tile_size = this.tile_size_real()
69+
const tile_size = this.tile_dims_real()
7070

71-
const pos_x = ( ( x / count - .5 ) * tile_size * scale_x + shift_x )
72-
const pos_y = ( ( y / count - .5 ) * tile_size * scale_y + shift_y )
71+
const pos_x = ( ( x / count - .5 ) * tile_size[0] * scale_x + shift_x )
72+
const pos_y = ( ( y / count - .5 ) * tile_size[1] * scale_y + shift_y )
7373

74-
const scale = scale_x / 2**level + .5 / tile_size
74+
const scale = scale_x / 2**level + .5 / tile_size[1]
7575

7676
return `translate3d(${pos_x}px,${pos_y}px,0px) scale(${scale})`
7777
}
@@ -96,11 +96,11 @@ namespace $.$$ {
9696

9797
const [ level, x, y ] = pos
9898
const count = 1 << level
99-
const tile_size = this.tile_size_real()
99+
const tile_size = this.tile_dims_real()
100100

101101
return [
102-
Math.floor( ( x / tile_size + .5 ) * count ),
103-
Math.floor( ( y / tile_size + .5 ) * count ),
102+
Math.floor( ( x / tile_size[0] + .5 ) * count ),
103+
Math.floor( ( y / tile_size[1] + .5 ) * count ),
104104
]
105105

106106
}

0 commit comments

Comments
 (0)
Please sign in to comment.