Skip to content

Commit

Permalink
Merge branch 'master' into #2423-hotkeys-for-atoms-dont-work-on-funct…
Browse files Browse the repository at this point in the history
…ional-groups-and-salts-abbreviations

# Conflicts:
#	packages/ketcher-react/src/script/editor/tool/atom.ts
  • Loading branch information
AnastasiiaPlyako committed May 18, 2023
2 parents f12f007 + 189c5ab commit 58b2a79
Show file tree
Hide file tree
Showing 26 changed files with 460 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ reviewGroups:
- yuleicul
- KonstantinEpam23
developers:
- VandaPonikarova
- VasilevDO
- AnastasiiaPlyako
- gairon
5 changes: 2 additions & 3 deletions .github/workflows/choose-reviewers.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Choose reviewers
on:
pull_request:
types: [opened, ready_for_review, reopened]
types: [opened]

jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/auto-assign-action@v1.2.5
with:
configuration-path: '.github/auto_assign.yml'
repo-token: ${{ secrets.REVIEWER_LOTTERY_SECRET }}
configuration-path: '.github/auto_assign.yml'
25 changes: 24 additions & 1 deletion packages/ketcher-core/src/application/editor/actions/sgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
SGroupDelete,
SGroupRemoveFromHierarchy
} from '../operations'
import { Pile, SGroup } from 'domain/entities'
import { FunctionalGroup, Pile, SGroup } from 'domain/entities'
import { atomGetAttr, atomGetDegree, atomGetSGroups } from './utils'

import { Action } from './action'
Expand Down Expand Up @@ -91,6 +91,29 @@ export function setExpandSGroup(restruct, sgid, attrs) {
return action.perform(restruct)
}

// todo delete after supporting expand - collapse for 2 attachment points
export function expandSGroupWithMultipleAttachmentPoint(restruct) {
const action = new Action()

const struct = restruct.molecule

struct.sgroups.forEach((sgroup) => {
const countAttachmentPoint = FunctionalGroup.getAttachmentPointCount(
sgroup,
struct
)
if (countAttachmentPoint > 1) {
action.mergeWith(
setExpandSGroup(restruct, sgroup.id, {
expanded: true
})
)
}
})

return action
}

export function sGroupAttributeAction(id, attrs) {
const action = new Action()

Expand Down
10 changes: 9 additions & 1 deletion packages/ketcher-core/src/application/render/restruct/reatom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ export enum ShowHydrogenLabels {
Hetero = 'Hetero',
Terminal = 'Terminal',
TerminalAndHetero = 'Terminal and Hetero',
On = 'on'
On = 'all'
}

export enum ShowHydrogenLabelNames {
Off = 'Off',
Hetero = 'Hetero',
Terminal = 'Terminal',
TerminalAndHetero = 'Terminal and Hetero',
On = 'On'
}

class ReAtom extends ReObject {
Expand Down
7 changes: 7 additions & 0 deletions packages/ketcher-core/src/typing.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Ketcher } from 'ketcher-core'

declare global {
interface Window {
ketcher: Ketcher
}
}
12 changes: 12 additions & 0 deletions packages/ketcher-core/src/utilities/emitEventRequestIsFinished.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const REQUEST_IS_FINISHED = 'REQUEST_IS_FINISHED'

/**
* Emit event when request is finished
* Used only for testers to prevent long delays in test cases
* Triggers on Add to canvas / Aromatize / Dearomatize
* Clean Up / Calculate CIP / Paste from clipboard
* maybe somewhere else
*/
export function emitEventRequestIsFinished(): void {
window?.ketcher?.eventBus.emit(REQUEST_IS_FINISHED)
}
1 change: 1 addition & 0 deletions packages/ketcher-core/src/utilities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export * from './ifDef'
export * from './tfx'
export * from './runAsyncAction'
export * from './b64toBlob'
export * from './emitEventRequestIsFinished'
3 changes: 2 additions & 1 deletion packages/ketcher-react/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ module.exports = {
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
'src(.*)$': '<rootDir>/src/$1'
}
},
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts']
}
15 changes: 12 additions & 3 deletions packages/ketcher-react/src/script/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { customOnChangeHandler } from './utils'
import { isEqual } from 'lodash/fp'
import toolMap from './tool'
import { Highlighter } from './highlighter'
import { showFunctionalGroupsTooltip } from './utils/functionalGroupsTooltip'
import { setFunctionalGroupsTooltip } from './utils/functionalGroupsTooltip'
import { contextMenuInfo } from '../ui/views/components/ContextMenu/contextMenu.types'
import { HoverIcon } from './HoverIcon'
import RotateController from './tool/rotate-controller'
Expand Down Expand Up @@ -384,14 +384,23 @@ class Editor implements KetcherEditor {

if (!event) return

showFunctionalGroupsTooltip(this)
setFunctionalGroupsTooltip({
editor: this,
event,
isShow: true
})
}

update(
action: Action | true,
ignoreHistory?: boolean,
options = { resizeCanvas: true }
) {
setFunctionalGroupsTooltip({
editor: this,
isShow: false
})

if (action === true) {
this.render.update(true, null, options) // force
} else {
Expand Down Expand Up @@ -462,7 +471,7 @@ class Editor implements KetcherEditor {

subscribe(eventName: any, handler: any) {
const subscriber = {
handler: handler
handler
}

switch (eventName) {
Expand Down
Loading

0 comments on commit 58b2a79

Please sign in to comment.