Skip to content

System shifts text label to the right #1683

@AlexeyGirin

Description

@AlexeyGirin

Steps to Reproduce

  1. Click Open... button (Ctrl+O)
  2. Select open from file
  3. Select file: Shifted label.pptx
    (Source CDX: FromPPTX.zip )
  4. Click Open

Actual behavior
Label is shifted to the left. It seems that source file save text label coordinates of the center of label but ketcher uses them as top left corner of the label
image

Expected behavior
image

Environment details:

Solution

Text justification support should be added to KET-format.
Currently text labels support represented in KET by the following json:

            {
                "type": "text",
                "data": {
                    "content": "{\"blocks\":[{\"key\":\"6ho73\",\"text\":\"TEST\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{}}",
                    "position": {
                        "x": 13.625,
                        "y": -10.125,
                        "z": 0
                    },
                    "pos": [
                        {
                            "x": 13.625,
                            "y": -10.125,
                            "z": 0
                        },
                        {
                            "x": 13.625,
                            "y": -10.5,
                            "z": 0
                        },
                        {
                            "x": 14.455859375,
                            "y": -10.5,
                            "z": 0
                        },
                        {
                            "x": 14.455859375,
                            "y": -10.125,
                            "z": 0
                        }
                    ]
                }
            }

where position is a left top text coordinate and pos is a bounding box.
To fix the issue it's necessary to support additional "justification" attribute:

        {
            "type": "text",
            "data": {
                "content": "----",
                "position": {
                 /----/
                },
                "pos": [
                ],
                "justification" : "center" // can be "center", "left", "right" and "full"
            }
        }

Metadata

Metadata

Assignees

Labels

CDX-ChemDrawBucket: Save/View/Open of CDX forrmat related issuesPriority: High

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions