-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathhor.view.ts
50 lines (40 loc) · 1.02 KB
/
hor.view.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace $.$$ {
export class $mol_plot_ruler_hor extends $.$mol_plot_ruler_hor {
dimensions_axis() {
return this.dimensions_pane().x
}
viewport_axis() {
return new this.$.$mol_vector_range(0, this.size_real().x)
}
scale_axis() {
return this.scale()[0]
}
scale_step() {
return this.scale()[0]
}
shift_axis() {
return this.shift()[0]
}
curve() {
const [shift] = this.shift()
const [scale] = this.scale()
return this.axis_points().map( point => {
let scaled = Math.round( point * scale + shift )
scaled = Math.max( Number.MIN_SAFE_INTEGER, Math.min( scaled, Number.MAX_SAFE_INTEGER ) )
return `M ${ scaled } 1000 V 0`
}).join( ' ' )
}
label_pos_x( index : number ) {
return (this.axis_points()[index] * this.scale()[0] + this.shift()[0]).toFixed(3)
}
background_y() {
return String(this.size_real()[1] - this.font_size())
}
title_pos_y() {
return String(this.size_real()[1])
}
background_height() {
return String(this.font_size())
}
}
}