@angular/cdk 11.1.0-rc.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/cdk-overlay.umd.js +24 -2
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +8 -8
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +25 -3
- package/esm2015/scrolling/virtual-for-of.js +1 -1
- package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/overlay.js +24 -2
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/scrolling.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
|
@@ -1902,7 +1902,10 @@
|
|
|
1902
1902
|
};
|
|
1903
1903
|
};
|
|
1904
1904
|
/** Gets how well an overlay at the given point will fit within the viewport. */
|
|
1905
|
-
FlexibleConnectedPositionStrategy.prototype._getOverlayFit = function (point,
|
|
1905
|
+
FlexibleConnectedPositionStrategy.prototype._getOverlayFit = function (point, rawOverlayRect, viewport, position) {
|
|
1906
|
+
// Round the overlay rect when comparing against the
|
|
1907
|
+
// viewport, because the viewport is always rounded.
|
|
1908
|
+
var overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1906
1909
|
var x = point.x, y = point.y;
|
|
1907
1910
|
var offsetX = this._getOffset(position, 'x');
|
|
1908
1911
|
var offsetY = this._getOffset(position, 'y');
|
|
@@ -1960,7 +1963,7 @@
|
|
|
1960
1963
|
* @returns The point at which to position the overlay after pushing. This is effectively a new
|
|
1961
1964
|
* originPoint.
|
|
1962
1965
|
*/
|
|
1963
|
-
FlexibleConnectedPositionStrategy.prototype._pushOverlayOnScreen = function (start,
|
|
1966
|
+
FlexibleConnectedPositionStrategy.prototype._pushOverlayOnScreen = function (start, rawOverlayRect, scrollPosition) {
|
|
1964
1967
|
// If the position is locked and we've pushed the overlay already, reuse the previous push
|
|
1965
1968
|
// amount, rather than pushing it again. If we were to continue pushing, the element would
|
|
1966
1969
|
// remain in the viewport, which goes against the expectations when position locking is enabled.
|
|
@@ -1970,6 +1973,9 @@
|
|
|
1970
1973
|
y: start.y + this._previousPushAmount.y
|
|
1971
1974
|
};
|
|
1972
1975
|
}
|
|
1976
|
+
// Round the overlay rect when comparing against the
|
|
1977
|
+
// viewport, because the viewport is always rounded.
|
|
1978
|
+
var overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1973
1979
|
var viewport = this._viewportRect;
|
|
1974
1980
|
// Determine how much the overlay goes outside the viewport on each
|
|
1975
1981
|
// side, which we'll use to decide which direction to push it.
|
|
@@ -2448,6 +2454,22 @@
|
|
|
2448
2454
|
}
|
|
2449
2455
|
return input || null;
|
|
2450
2456
|
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Gets a version of an element's bounding `ClientRect` where all the values are rounded down to
|
|
2459
|
+
* the nearest pixel. This allows us to account for the cases where there may be sub-pixel
|
|
2460
|
+
* deviations in the `ClientRect` returned by the browser (e.g. when zoomed in with a percentage
|
|
2461
|
+
* size, see #21350).
|
|
2462
|
+
*/
|
|
2463
|
+
function getRoundedBoundingClientRect(clientRect) {
|
|
2464
|
+
return {
|
|
2465
|
+
top: Math.floor(clientRect.top),
|
|
2466
|
+
right: Math.floor(clientRect.right),
|
|
2467
|
+
bottom: Math.floor(clientRect.bottom),
|
|
2468
|
+
left: Math.floor(clientRect.left),
|
|
2469
|
+
width: Math.floor(clientRect.width),
|
|
2470
|
+
height: Math.floor(clientRect.height)
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2451
2473
|
|
|
2452
2474
|
/**
|
|
2453
2475
|
* @license
|