-
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.
- Loading branch information
1 parent
9003ae9
commit 5fe455d
Showing
39 changed files
with
309 additions
and
308 deletions.
There are no files selected for viewing
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
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.