Skip to content

Commit

Permalink
Backmerge: #2681 – Calculate CIP: stereolabels appears under structure;
Browse files Browse the repository at this point in the history
#2679 – Highlight colors for Simple Objects do not match the new design; #2683 – Missing circles to expand reaction arrows (#2706) (#2711)

* #2681 – Calculate CIP: stereolabels appears under structure

* #2683 – Missing circles to expand reaction arrows
  • Loading branch information
Nitvex authored May 30, 2023
1 parent a119b50 commit 43e3710
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/ketcher-core/src/application/render/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function defaultOptions(opt) {
'stroke-width': '1px'
},
hoverStyleSimpleObject: {
stroke: '#0c0',
stroke: '#57FF8F',
'stroke-width': scaleFactor / 4,
'stroke-linecap': 'round',
'stroke-opacity': 0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
* limitations under the License.
***************************************************************************/

/*
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
*/
export enum LayerMap {
background = 'background',
selectionPlate = 'selectionPlate',
hovering = 'hovering',
warnings = 'warnings',
data = 'data',
additionalInfo = 'additionalInfo',
indices = 'indices'
}

Expand Down
26 changes: 16 additions & 10 deletions packages/ketcher-core/src/application/render/restruct/rerxnarrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,10 @@ class ReRxnArrow extends ReObject {
return refPoints
}

makeSelectionPlate(restruct: ReStruct, _paper, styles) {
const render = restruct.render
const options = restruct.render.options

makeAdditionalInfo(restruct: ReStruct) {
const scaleFactor = restruct.render.options.scale
const refPoints = this.getReferencePoints()
const scaleFactor = options.scale
const selectionSet = restruct.render.paper.set()
selectionSet.push(
render.paper
.path(this.generatePath(render, options, 'selection'))
.attr(styles.selectionStyle)
)

refPoints.forEach((rp) => {
const scaledRP = Scale.obj2scaled(rp, restruct.render.options)
Expand All @@ -144,6 +136,20 @@ class ReRxnArrow extends ReObject {
.attr({ fill: 'black' })
)
})

return selectionSet
}

makeSelectionPlate(restruct: ReStruct, _paper, styles) {
const render = restruct.render
const options = restruct.render.options
const selectionSet = restruct.render.paper.set()

selectionSet.push(
render.paper
.path(this.generatePath(render, options, 'selection'))
.attr(styles.selectionStyle)
)
return selectionSet
}

Expand Down
11 changes: 11 additions & 0 deletions packages/ketcher-core/src/application/render/restruct/restruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,27 @@ class ReStruct {
item.visel,
item.selectionPlate
)

if (typeof item.makeAdditionalInfo === 'function') {
item.additionalInfo = item.makeAdditionalInfo(this)
this.addReObjectPath(
LayerMap.additionalInfo,
item.visel,
item.additionalInfo
)
}
}
if (item.selectionPlate) {
item.selectionPlate.show()
item.additionalInfo?.show()
item.cip?.rectangle.attr({
fill: '#7f7',
stroke: '#7f7'
})
}
} else if (exists && item.selectionPlate) {
item.selectionPlate.hide()
item.additionalInfo?.hide()
item.cip?.rectangle.attr({
fill: '#fff',
stroke: '#fff'
Expand Down
2 changes: 1 addition & 1 deletion packages/ketcher-core/src/application/render/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function drawCIPLabel({
cipValuePath.path.translateAbs(0.5 * box.width, -0.5 * box.height)
path.push(cipValuePath.path.toFront())

restruct.addReObjectPath(LayerMap.data, visel, path, null, true)
restruct.addReObjectPath(LayerMap.additionalInfo, visel, path, null, true)

return cipValuePath
}
Expand Down

0 comments on commit 43e3710

Please sign in to comment.