Big change to operation!

This commit is contained in:
wqy
2022-09-24 23:00:55 +08:00
parent 46df1beedb
commit 11e30cc49f
6 changed files with 286 additions and 256 deletions

View File

@@ -5,10 +5,8 @@ from .operation import *
from .change_set import ChangeSet
def _to_point(coord: str) -> dict[str, float]:
coord = coord.removeprefix('(')
coord = coord.removesuffix(')')
coord = coord.split(',')
def _to_client_point(coord: str) -> dict[str, float]:
coord = coord.removeprefix('(').removesuffix(')').split(',')
return { 'x': float(coord[0]), 'y': float(coord[1]) }
@@ -20,7 +18,7 @@ def get_node_coord(name: str, id: str) -> dict[str, float] | None:
return None
coord = str(row['coord'])
return _to_point(coord)
return _to_client_point(coord)
def set_node_coord(name: str, node_type: str, id: str, x: float, y: float) -> ChangeSet: