-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3666 make opening structure in center of the screen
- Loading branch information
1 parent
6aba3da
commit b7738bf
Showing
15 changed files
with
137 additions
and
21 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/ketcher-core/__tests__/application/editor/shared/coordinates.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
packages/ketcher-core/src/application/editor/tools/Paste.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// /**************************************************************************** | ||
// * Copyright 2021 EPAM Systems | ||
// * | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// ***************************************************************************/ | ||
// import { Coordinates, CoreEditor, EditorHistory } from 'application/editor'; | ||
// import { BaseTool } from 'application/editor/tools/Tool'; | ||
// import { SupportedFormat, identifyStructFormat } from 'application/formatters'; | ||
// import assert from 'assert'; | ||
// import { IndigoProvider } from 'ketcher-react'; | ||
// import { KetSerializer } from 'domain/serializers'; | ||
// import { ChemicalMimeType, StructService } from 'domain/services'; | ||
// import { Vec2 } from 'domain/entities'; | ||
|
||
// class PasteTool implements BaseTool { | ||
// private history: EditorHistory; | ||
// private readonly struct: string; | ||
|
||
// constructor(private editor: CoreEditor, struct: string) { | ||
// this.editor = editor; | ||
// this.struct = struct; | ||
// this.history = new EditorHistory(editor); | ||
// this.convertStruct(); | ||
// } | ||
|
||
// async convertStruct() { | ||
// const isKet = identifyStructFormat(this.struct) === SupportedFormat.ket; | ||
// const ketSerializer = new KetSerializer(); | ||
// const editor = CoreEditor.provideEditorInstance(); | ||
// if (isKet) { | ||
// this.addToCanvas({ struct: this.struct, ketSerializer, editor }); | ||
// return; | ||
// } | ||
// const indigo = IndigoProvider.getIndigo() as StructService; | ||
// const ketStruct = await indigo.convert({ | ||
// struct: this.struct, | ||
// output_format: ChemicalMimeType.KET, | ||
// }); | ||
// this.addToCanvas({ struct: ketStruct.struct, ketSerializer, editor }); | ||
// } | ||
|
||
// addToCanvas({ | ||
// ketSerializer, | ||
// editor, | ||
// struct, | ||
// }: { | ||
// ketSerializer: KetSerializer; | ||
// editor: CoreEditor; | ||
// struct: string; | ||
// }) { | ||
// const centerPointOfCanvas = Coordinates.canvasToModel( | ||
// new Vec2( | ||
// this.editor.canvasOffset.width / 2, | ||
// this.editor.canvasOffset.height / 2, | ||
// ), | ||
// ); | ||
// const deserialisedKet = ketSerializer.deserializeToDrawingEntities( | ||
// struct, | ||
// centerPointOfCanvas, | ||
// ); | ||
// assert(deserialisedKet); | ||
// deserialisedKet.drawingEntitiesManager.mergeInto( | ||
// editor.drawingEntitiesManager, | ||
// ); | ||
// this.history.update(deserialisedKet.modelChanges); | ||
// editor.renderersContainer.update(deserialisedKet.modelChanges); | ||
// } | ||
|
||
// destroy() {} | ||
// } | ||
|
||
// export { PasteTool }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/ketcher-core/src/domain/helpers/attachmentPointCalculations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters