-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Show all regions" for dotplot and synteny views and refactor synteny…
… rendering RPC to optimize scrolling (#3440) * Add show all regions to dotplot view * Add showAllRegions button * Draw multiple line with single stroke * Subviews initialized * Loop min/max/sum * Misc code whitespace * Only run bpToPx if needed * Remove renderer concept from linear-comparative-view * Use autorun/reaction to draw canvas contents instead of complicated useEffects * Bump yarn.lock * Remove renderer * Update auto-generated docs * Limit below which to draw line instead of box
- Loading branch information
Showing
59 changed files
with
1,892 additions
and
1,790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { getParent, Instance } from 'mobx-state-tree' | ||
import { observable } from 'mobx' | ||
import Base1DView from '@jbrowse/core/util/Base1DViewModel' | ||
import calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks' | ||
|
||
/** | ||
* #stateModel Dotplot1DView | ||
* ref https://mobx-state-tree.js.org/concepts/volatiles on volatile state used here | ||
*/ | ||
const Dotplot1DView = Base1DView.extend(self => { | ||
const scaleFactor = observable.box(1) | ||
return { | ||
views: { | ||
/** | ||
* #getter | ||
* this uses padding=false and elision=false | ||
*/ | ||
get dynamicBlocks() { | ||
return calculateDynamicBlocks(self, false, false) | ||
}, | ||
/** | ||
* #getter | ||
*/ | ||
|
||
get scaleFactor() { | ||
return scaleFactor.get() | ||
}, | ||
|
||
/** | ||
* #getter | ||
*/ | ||
get maxBpPerPx() { | ||
return self.totalBp / self.width | ||
}, | ||
}, | ||
actions: { | ||
/** | ||
* #action | ||
*/ | ||
setScaleFactor(n: number) { | ||
scaleFactor.set(n) | ||
}, | ||
|
||
/** | ||
* #action | ||
*/ | ||
center() { | ||
const centerBp = self.totalBp / 2 | ||
const centerPx = centerBp / self.bpPerPx | ||
self.scrollTo(Math.round(centerPx - self.width / 2)) | ||
}, | ||
}, | ||
} | ||
}) | ||
|
||
const DotplotHView = Dotplot1DView.extend(self => ({ | ||
views: { | ||
get width() { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return getParent<any>(self).viewWidth | ||
}, | ||
}, | ||
})) | ||
|
||
const DotplotVView = Dotplot1DView.extend(self => ({ | ||
views: { | ||
get width() { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return getParent<any>(self).viewHeight | ||
}, | ||
}, | ||
})) | ||
|
||
export { DotplotVView, DotplotHView, Dotplot1DView } | ||
export type Dotplot1DViewModel = Instance<typeof Dotplot1DView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.