@atlaskit/media-card 79.9.0 → 79.9.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 79.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2fe94e8511b55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fe94e8511b55) -
8
+ Improved same-aspect-ratio detection in image rendering by using threshold-based comparison
9
+ instead of rounding-based comparison. This fixes edge cases where images with negligible aspect
10
+ ratio differences (1-2 pixels) from their parent container were incorrectly treated as different
11
+ ratios, causing unnecessary style recalculations and sub-optimal rendering strategies.
12
+
3
13
  ## 79.9.0
4
14
 
5
15
  ### Minor Changes
@@ -36,7 +36,7 @@ var calculateDimensions = exports.calculateDimensions = function calculateDimens
36
36
  var imgRatio = imgWidth / imgHeight;
37
37
  var cardRatio = parentWidth / parentHeight;
38
38
  if ((0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix')) {
39
- var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
39
+ var isSameRatio = (0, _platformFeatureFlags.fg)('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
40
40
  if (isSameRatio) {
41
41
  if (resizeMode === 'stretchy-fit') {
42
42
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
@@ -33,7 +33,7 @@ export const calculateDimensions = (imgElement, parentElement, resizeMode) => {
33
33
  const imgRatio = imgWidth / imgHeight;
34
34
  const cardRatio = parentWidth / parentHeight;
35
35
  if (fg('media-perf-uplift-mutation-fix')) {
36
- const isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
36
+ const isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
37
37
  if (isSameRatio) {
38
38
  if (resizeMode === 'stretchy-fit') {
39
39
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
@@ -30,7 +30,7 @@ export var calculateDimensions = function calculateDimensions(imgElement, parent
30
30
  var imgRatio = imgWidth / imgHeight;
31
31
  var cardRatio = parentWidth / parentHeight;
32
32
  if (fg('media-perf-uplift-mutation-fix')) {
33
- var isSameRatio = roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
33
+ var isSameRatio = fg('media-perf-ratio-calc-fix') ? Math.abs(imgWidth / parentWidth - imgHeight / parentHeight) < 0.1 : roundedRatio(imgWidth / parentWidth) === roundedRatio(imgHeight / parentHeight);
34
34
  if (isSameRatio) {
35
35
  if (resizeMode === 'stretchy-fit') {
36
36
  return DEFAULT_STRETCHY_FIT_DIMENSIONS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "79.9.0",
3
+ "version": "79.9.1",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/media-file-preview": "^0.15.0",
43
43
  "@atlaskit/media-svg": "^2.1.0",
44
44
  "@atlaskit/media-ui": "^28.7.0",
45
- "@atlaskit/media-viewer": "^52.4.0",
45
+ "@atlaskit/media-viewer": "^52.5.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/primitives": "^16.4.0",
48
48
  "@atlaskit/react-ufo": "^4.15.0",
@@ -140,6 +140,9 @@
140
140
  },
141
141
  "media-perf-lazy-loading-optimisation": {
142
142
  "type": "boolean"
143
+ },
144
+ "media-perf-ratio-calc-fix": {
145
+ "type": "boolean"
143
146
  }
144
147
  },
145
148
  "techstack": {