Unverified Commit e4be4631 authored by Dan Sheppard's avatar Dan Sheppard Committed by GitHub
Browse files

Boundary marker for location focused views (#190)

* Basic bumped scaling for margin-free regions.

* Correct for potentially lop-sided borders.

* Tweak padding pixels for small screens.

Ideally we need to find out why any padding pixels at all are needed.
But this works down to 1100px at least for now. I'll JIRA the rest.

* Update packages.
parent 543f0fb0
Pipeline #45617 passed with stages
in 3 minutes and 58 seconds
......@@ -50,7 +50,7 @@ impl Stick {
}
pub fn get_wrapping(&self) -> Wrapping {
Wrapping::new(36.,36.)
Wrapping::new(56.,58.) // XXX not hardwired. Why is this in Stick anyway?
}
}
......
......@@ -72,10 +72,10 @@ impl GLCarriage {
}
pub fn get_uniforms(&self, leaf: &Leaf, opacity: f32, screen: &Screen, pos: &Position) -> HashMap<String,UniformValue> {
let bp_per_screen = pos.get_screen_in_bp();
let bp_per_screen = pos.get_bumped_screen_in_bp();
let bp_per_leaf = leaf.total_bp();
let leaf_per_screen = bp_per_screen as f64 / bp_per_leaf;
let middle_bp = pos.get_middle();
let middle_bp = pos.get_bumped_middle();
let middle_leaf = middle_bp.0/bp_per_leaf; // including fraction of leaf
let current_leaf_left = leaf.get_index() as f64;
let screen_px = screen.get_size();
......
......@@ -48,6 +48,11 @@ impl Position {
pub fn get_screen_in_bp(&self) -> f64 {
self.zoom.get_screen_in_bp()
}
pub fn get_bumped_screen_in_bp(&self) -> f64 {
let delta = self.px_to_bp(self.min_x_bumper) + self.px_to_bp(self.max_x_bumper);
self.zoom.get_screen_in_bp()+delta
}
pub fn set_screen_in_bp(&mut self, zoom: f64) {
self.zoom.set_screen_in_bp(zoom);
......@@ -118,6 +123,22 @@ impl Position {
Dot(self.pos.0,self.pos.1)
}
pub fn get_bumped_middle(&self) -> Dot<f64,f64> {
let left_bp = self.px_to_bp(self.min_x_bumper);
let right_bp = self.px_to_bp(self.max_x_bumper);
/*
inner centre is at self.pos.0
inner left is at self.pos.0 - bp_per_sc/2
inner right is at self.pos.0 + bp_per_sc/2
outer left is at self.pos.0 - bp_per_sc/2 - left_bp
outer right is at self.pos.0 + bp_per_sc/2 + right_bp
outer middle is at mean, ie (self.pos.0 - bp_per_sc/2 - left_bp + self.pos.0 + bp_per_sc/2 + right_bp)/2
so outer middle is at self.pos.0 + (right_bp-left_bp)/2
correction is to add (right_bp-left_bp)/2
*/
Dot(self.pos.0+(right_bp-left_bp)/2.,self.pos.1)
}
fn px_to_bp(&self, px: f64) -> f64 {
px / self.screen_size.0 as f64 * self.zoom.get_screen_in_bp()
}
......
......@@ -7619,8 +7619,8 @@
}
},
"ensembl-genome-browser": {
"version": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-4638fc286422bda2e65c08616b525002.tar.gz",
"integrity": "sha512-Q6AlyDneXiWnHRaxmYXcmvKJBKQo7GKL7fKb12XxfMYHmt3ibuA1uh2498ooj7qeGAY3cBuf4rAhQEkHpFd6ow=="
"version": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-1cdabb861b07a31cc27ffa943baf4e10.tar.gz",
"integrity": "sha512-g9jrw7vEqVOyV/jMOOSJNwaYiTtZ7EF7tsGQO01Wc4fSYnHUEhVeGf5zq2Sf2q/S5NFsOrb5QooGxw2rW0Ql3A=="
},
"entities": {
"version": "1.1.2",
......
......@@ -54,7 +54,7 @@
"connected-react-router": "6.5.2",
"core-js": "3.3.6",
"dotenv": "8.2.0",
"ensembl-genome-browser": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-4638fc286422bda2e65c08616b525002.tar.gz",
"ensembl-genome-browser": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-1cdabb861b07a31cc27ffa943baf4e10.tar.gz",
"koa-proxy": "1.0.0-alpha.3",
"lodash": "4.17.15",
"query-string": "6.8.3",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment