Skip to content

Commit

Permalink
Wow
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Aug 15, 2024
1 parent 0bbe6d9 commit 17d691f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ import { firstValueFrom } from 'rxjs'
import { AnyConfigurationModel } from '../../configuration'

export interface RenderArgs extends ServerSideRenderArgs {
displayModel: Record<string, unknown>
blockKey: string
}

export interface RenderArgsSerialized extends ServerSideRenderArgsSerialized {
displayModel: Record<string, unknown>
blockKey: string
}

export interface RenderArgsDeserialized
extends ServerSideRenderArgsDeserialized {
displayModel: Record<string, unknown>
blockKey: string
}

Expand All @@ -53,10 +50,6 @@ export default class ComparativeServerSideRenderer extends ServerSideRenderer {
* directly modifies the render arguments to prepare them to be serialized
* and sent to the worker.
*
* the base class replaces the `displayModel` param (which on the client is a
* MST model) with a stub that only contains the `selectedFeature`, since
* this is the only part of the track model that most renderers read.
*
* @param args - the arguments passed to render
* @returns the same object
*/
Expand All @@ -68,7 +61,7 @@ export default class ComparativeServerSideRenderer extends ServerSideRenderer {
serializeArgsInClient(args: RenderArgs) {
const deserializedArgs = {
...args,
displayModel: {},
displayModel: undefined,
}

return super.serializeArgsInClient(deserializedArgs)
Expand All @@ -80,7 +73,10 @@ export default class ComparativeServerSideRenderer extends ServerSideRenderer {
args: RenderArgs,
): ResultsDeserialized {
const deserialized = super.deserializeResultsInClient(result, args)
return { ...deserialized, blockKey: args.blockKey }
return {
...deserialized,
blockKey: args.blockKey,
}
}

/**
Expand Down
5 changes: 3 additions & 2 deletions plugins/wiggle/src/MultiWiggleRendering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const MultiWiggleRendering = observer(function (props: {
height: number
blockKey: string
sources: Source[]
displayModel: { isMultiRow: boolean }
displayModel?: { isMultiRow: boolean }
onMouseLeave?: (event: React.MouseEvent) => void
onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void
onFeatureClick?: (event: React.MouseEvent, arg?: Feature) => void
Expand All @@ -33,6 +33,7 @@ const MultiWiggleRendering = observer(function (props: {
} = props
const region = regions[0]!
const ref = useRef<HTMLDivElement>(null)
const { isMultiRow } = displayModel || {}

function getFeatureUnderMouse(eventClientX: number, eventClientY: number) {
if (!ref.current) {
Expand All @@ -48,7 +49,7 @@ const MultiWiggleRendering = observer(function (props: {
const px = region.reversed ? width - offsetX : offsetX
const mouseoverBp = region.start + bpPerPx * px
let featureUnderMouse: Feature | undefined
if (displayModel.isMultiRow) {
if (isMultiRow) {
for (const feature of features.values()) {
if (feature.get('source') !== source.name) {
continue
Expand Down

0 comments on commit 17d691f

Please sign in to comment.