Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2267- Using Template Tool, Salts and Solvents should replace Atoms, Functional Groups, and Salts and Solvents & #1994 - Salts and Solvents: Edit notification appears instead of replacing new Salt or Solvent #2391

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/ketcher-core/src/application/editor/actions/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import { Action } from './action'
import { Vec2 } from 'domain/entities'
import { fromSgroupAddition } from './sgroup'

export type PasteItems = {
atoms: number[]
bonds: number[]
}
export function fromPaste(restruct, pstruct, point, angle = 0) {
const xy0 = getStructCenter(pstruct)
const offset = Vec2.diff(point, xy0)
Expand All @@ -41,7 +45,7 @@ export function fromPaste(restruct, pstruct, point, angle = 0) {
const aidMap = new Map()
const fridMap = new Map()

const pasteItems: any = {
const pasteItems: PasteItems = {
// only atoms and bonds now
atoms: [],
bonds: []
Expand Down Expand Up @@ -158,7 +162,7 @@ export function fromPaste(restruct, pstruct, point, angle = 0) {
})

action.operations.reverse()
return [action, pasteItems]
return [action, pasteItems] as const
}

function getStructCenter(struct) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function fromTemplateOnCanvas(restruct, template, pos, angle) {

action.addOp(new CalcImplicitH(pasteItems.atoms).perform(restruct))

return [action, pasteItems]
return [action, pasteItems] as const
}

function extraBondAction(restruct, aid, angle) {
Expand Down
Loading