Skip to content

Conversation

@crisbeto
Copy link
Member

Switches the ConnectedPositionStrategy to use top and left for positioning, instead of translateX and translateY. This avoids having to do extra work to prevent subpixel rendering issues, while freeing up the transforms to be used on animations or for offsets.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 29, 2016
@crisbeto crisbeto force-pushed the connected-position-top-left branch from b5cc8e6 to cdc7b70 Compare November 29, 2016 21:08

/** The offset in pixels for the overlay connection point on the x-axis */
private _offsetX: number = 0;
private _x: number = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename these? They are still offset values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they still looked pretty similar to the transforms. I'll put them back.

// because it will need to be used for animations.
applyCssTransform(element, `translateX(${x}px) translateY(${y}px)`);
element.style.left = overlayPoint.x + 'px';
element.style.top = overlayPoint.y + 'px';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not still round these, or do browsers simply ignore subpixel top/left?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like it's an issue with the top/left properties.

fixture.detectChanges();

const overlayPane = overlayContainerElement.children[0] as HTMLElement;
overlayPane.style.position = 'absolute';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because it doesn't look like we import all of the styles in the unit tests. This means that the overlay is position: static. It wasn't an issue with the transform approach since they work on all of the positions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just add a comment mentioning that?

@jelbourn
Copy link
Member

@kara should also take a look

@crisbeto crisbeto force-pushed the connected-position-top-left branch 2 times, most recently from 624dc07 to f6c9ae4 Compare December 1, 2016 18:24
@crisbeto
Copy link
Member Author

crisbeto commented Dec 1, 2016

Rebased and addressed the feedback.

@jelbourn
Copy link
Member

jelbourn commented Dec 1, 2016

@kara will this conflict with your select alignment PR?

@crisbeto
Copy link
Member Author

crisbeto commented Dec 2, 2016

Seems like a bunch of tests are failing on this one now. I'll take a better look into it tomorrow.

…orms for positioning

Switches the `ConnectedPositionStrategy` to use `top` and `left` for positioning, instead of `translateX` and `translateY`. This avoids having to do extra work to prevent subpixel rendering issues, while freeing up the transforms to be used on animations or for offsets.
@crisbeto crisbeto force-pushed the connected-position-top-left branch from f6c9ae4 to e693fac Compare December 3, 2016 11:22
@crisbeto
Copy link
Member Author

crisbeto commented Dec 3, 2016

Tests are sorted out now.

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Dec 5, 2016
@mmalerba mmalerba merged commit 8c5a5e1 into angular:master Dec 6, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants