Skip to content

Feature: Compute connection point coordinates for non-rectangular shapes (accessed by 'cxn_pt_idx')#628

Open
mohammedFurqan wants to merge 1 commit into
scanny:masterfrom
mohammedFurqan:nonRectangularShapeConnect
Open

Feature: Compute connection point coordinates for non-rectangular shapes (accessed by 'cxn_pt_idx')#628
mohammedFurqan wants to merge 1 commit into
scanny:masterfrom
mohammedFurqan:nonRectangularShapeConnect

Conversation

@mohammedFurqan
Copy link
Copy Markdown

This PR contains two changes:

  1. The Experimental feature functions _move_begin_to_cxn and _move_end_to_cxn compute connection point locations for a given shape. The existing logic works only in the case of Rectangle.
    In order to compute connection point co-ordinates for other shapes, a hard-coded approach is taken, which is similar to what the PowerPoint team itself uses currently.
    The idea is to compute the locations of points relative to the shape width and height for each shape type. This idea works surprisingly well in estimating the location. Even if we are off by few (1-4) pixels, the PowerPoint automatically fixes the difference.
    Please check this answer for detailed explanation on Stackoverflow to a question asked by me.

  2. The second subtle change is introduction of a new function that contains the common logic which is used by both the function: _move_begin_to_cxn and _move_end_to_cxn. This is to avoid the need to make repeated changes in two different locations.

I have tested this approach on Oval and Parallelogram shapes and it works smoothly for any size of shapes. The same idea can be extended to support more shapes.

@mohammedFurqan mohammedFurqan changed the title Feature: ompute connection point locations for shapes Feature: Compute connection point locations for shapes accessed by 'cxn_pt_idx' Jun 30, 2020
@mohammedFurqan mohammedFurqan changed the title Feature: Compute connection point locations for shapes accessed by 'cxn_pt_idx' Feature: Compute connection point coordinates for non-rectangular shapes (accessed by 'cxn_pt_idx') Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant