Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohammedFurqan
Copy link

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