-
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.
Preview: Update Image object in KET file to support CDX/CDXML format (#…
…5188) * #5172 - updated ket image format * #5172 - fixed failing types * #5172 - fixed regex * #5172 - fixed package-lock file * #5172 - updated file mime regexp
- Loading branch information
1 parent
9a0f30c
commit 61cd5a5
Showing
41 changed files
with
327 additions
and
329 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
packages/ketcher-core/src/application/editor/actions/image.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,48 @@ | ||
import { ReStruct } from 'application/render'; | ||
import { ImageReferencePositionInfo, Vec2 } from 'domain/entities'; | ||
import { | ||
Action, | ||
ImageDelete, | ||
ImageMove, | ||
ImageResize, | ||
ImageUpsert, | ||
} from 'application/editor'; | ||
import { Image } from 'domain/entities/image'; | ||
|
||
export function fromImageCreation( | ||
reStruct: ReStruct, | ||
bitmap: string, | ||
center: Vec2, | ||
halfSize: Vec2, | ||
) { | ||
const action = new Action(); | ||
const image = new Image(bitmap, center, halfSize); | ||
action.addOp(new ImageUpsert(image)); | ||
return action.perform(reStruct); | ||
} | ||
|
||
export function fromImageDeletion(reStruct: ReStruct, id: number) { | ||
const action = new Action(); | ||
action.addOp(new ImageDelete(id)); | ||
return action.perform(reStruct); | ||
} | ||
|
||
export function fromImageMove(reStruct: ReStruct, id: number, offset: Vec2) { | ||
const action = new Action(); | ||
action.addOp(new ImageMove(id, offset)); | ||
return action.perform(reStruct); | ||
} | ||
|
||
export function fromImageResize( | ||
reStruct: ReStruct, | ||
id: number, | ||
position: Vec2, | ||
referencePositionInfo: ImageReferencePositionInfo, | ||
) { | ||
const action = new Action(); | ||
const positionWithOffset = position.add(referencePositionInfo.offset); | ||
action.addOp( | ||
new ImageResize(id, positionWithOffset, referencePositionInfo.name), | ||
); | ||
return action.perform(reStruct); | ||
} |
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
52 changes: 0 additions & 52 deletions
52
packages/ketcher-core/src/application/editor/actions/rasterImage.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.