Skip to content

Commit

Permalink
#2595 - feat: add a layer for the atom so that it is drawn over the b…
Browse files Browse the repository at this point in the history
…onds (hovering)
  • Loading branch information
Iogsotot committed Jul 10, 2023
1 parent ad9f004 commit c3e917c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

/*
This map is used to draw anything on 'layers'
You can treat these values as z-index: backround has the lowest z-index, indices has the highest
You can treat these values as z-index: background has the lowest z-index, indices has the highest
*/
export enum LayerMap {
background = 'background',
selectionPlate = 'selectionPlate',
hovering = 'hovering',
atom = 'atom',
warnings = 'warnings',
data = 'data',
additionalInfo = 'additionalInfo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ReAtom extends ReObject {

drawHover(render: Render) {
const ret = this.makeHoverPlate(render)
render.ctab.addReObjectPath(LayerMap.hovering, this.visel, ret)
render.ctab.addReObjectPath(LayerMap.atom, this.visel, ret)
return ret
}

Expand Down Expand Up @@ -317,7 +317,7 @@ class ReAtom extends ReObject {

this.hydrogenOnTheLeft = setHydrogenPos(restruct.molecule, this)
this.showLabel = isLabelVisible(restruct, render.options, this)
this.color = 'black' // reset colour
this.color = 'black' // reset color

let delta
let rightMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class ReBond extends ReObject {
if (!hb1 || !hb2) return
this.path = getBondPath(restruct, this, hb1, hb2)
this.rbb = util.relBox(this.path.getBBox())
// add layer for bond's skeleton:
restruct.addReObjectPath(LayerMap.data, this.visel, this.path, null, true)
const reactingCenter: any = {}
reactingCenter.path = getReactingCenterPath(render, this, hb1, hb2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ReText extends ReObject {
drawHover(render: any): any {
if (!this.paths.length) return null
const ret = this.hoverPath(render).attr(render.options.hoverStyle)
render.ctab.addReObjectPath(LayerMap.hovering, this.visel, ret)
render.ctab.addReObjectPath(LayerMap.data, this.visel, ret)
return ret
}

Expand Down

0 comments on commit c3e917c

Please sign in to comment.