Skip to content

Commit

Permalink
#85 refactor + fixed few bags
Browse files Browse the repository at this point in the history
  • Loading branch information
ensemenova committed Feb 8, 2021
1 parent c0722aa commit 4361024
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 321 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SimpleObject {
pos: Array<Vec2>
mode: SimpleObjectMode

constructor(params) {
constructor(params: { mode: SimpleObjectMode, pos?: Array<Vec2> }) {
params = params || {}
this.pos = []

Expand Down
291 changes: 0 additions & 291 deletions packages/ketcher-react/src/script/editor/operations/simpleObject.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/****************************************************************************
* 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 {SimpleObjectDelete} from "./simpleObjectDelete";
import {SimpleObjectAdd} from "./simpleObjectAdd";
import Base from "../base";
import {SimpleObjectMove} from "./simpleObjectMove";
import {SimpleObjectResize} from "./simpleObjectResize";


class SimpleObjectAddImpl extends SimpleObjectAdd {
invert(): Base {
//@ts-ignore
return new SimpleObjectDelete(this.data.id)
}
}

class SimpleObjectDeleteImpl extends SimpleObjectDelete {
invert(): Base {
return new SimpleObjectAdd(this.data.pos, this.data.mode, this.data.toCircle)
}
}

class SimpleObjectMoveImpl extends SimpleObjectMove {
invert(): Base {
return new SimpleObjectMove(this.data.id, this.data.d, this.data.noinvalidate)
}
}

class SimpleObjectResizeImpl extends SimpleObjectResize {
invert(): Base {
return new SimpleObjectResize(this.data.id, this.data.d, this.data.current, this.data.anchor, this.data.noinvalidate, this.data.toCircle)
}
}

export {
SimpleObjectAddImpl as SimpleObjectAdd,
SimpleObjectDeleteImpl as SimpleObjectDelete,
SimpleObjectMoveImpl as SimpleObjectMove,
SimpleObjectResizeImpl as SimpleObjectResize
}
Loading

0 comments on commit 4361024

Please sign in to comment.