@midscene/android 1.0.1-beta-20251104101357.0 → 1.0.1-beta-20251107042357.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/dist/es/index.mjs CHANGED
@@ -290,7 +290,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
290
290
  const result = {
291
291
  override: sizeStr,
292
292
  physical: sizeStr,
293
- orientation: rotation
293
+ orientation: rotation,
294
+ isCurrentOrientation: true
294
295
  };
295
296
  if (shouldCache) this.cachedScreenSize = result;
296
297
  return result;
@@ -313,7 +314,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
313
314
  const result = {
314
315
  override: sizeStr,
315
316
  physical: sizeStr,
316
- orientation: rotation
317
+ orientation: rotation,
318
+ isCurrentOrientation: true
317
319
  };
318
320
  if (shouldCache) this.cachedScreenSize = result;
319
321
  return result;
@@ -346,7 +348,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
346
348
  if (size.override || size.physical) {
347
349
  const result = {
348
350
  ...size,
349
- orientation
351
+ orientation,
352
+ isCurrentOrientation: false
350
353
  };
351
354
  if (shouldCache) this.cachedScreenSize = result;
352
355
  return result;
@@ -432,8 +435,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
432
435
  const match = (screenSize.override || screenSize.physical).match(/(\d+)x(\d+)/);
433
436
  if (!match || match.length < 3) throw new Error(`Unable to parse screen size: ${screenSize}`);
434
437
  const isLandscape = 1 === screenSize.orientation || 3 === screenSize.orientation;
435
- const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
436
- const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
438
+ const shouldSwap = true !== screenSize.isCurrentOrientation && isLandscape;
439
+ const width = Number.parseInt(match[shouldSwap ? 2 : 1], 10);
440
+ const height = Number.parseInt(match[shouldSwap ? 1 : 2], 10);
437
441
  const scale = (null == (_this_options = this.options) ? void 0 : _this_options.screenshotResizeScale) ?? 1 / this.devicePixelRatio;
438
442
  this.scalingRatio = scale;
439
443
  const logicalWidth = Math.round(width * scale);
package/dist/lib/index.js CHANGED
@@ -336,7 +336,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
336
336
  const result = {
337
337
  override: sizeStr,
338
338
  physical: sizeStr,
339
- orientation: rotation
339
+ orientation: rotation,
340
+ isCurrentOrientation: true
340
341
  };
341
342
  if (shouldCache) this.cachedScreenSize = result;
342
343
  return result;
@@ -359,7 +360,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
359
360
  const result = {
360
361
  override: sizeStr,
361
362
  physical: sizeStr,
362
- orientation: rotation
363
+ orientation: rotation,
364
+ isCurrentOrientation: true
363
365
  };
364
366
  if (shouldCache) this.cachedScreenSize = result;
365
367
  return result;
@@ -392,7 +394,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
392
394
  if (size.override || size.physical) {
393
395
  const result = {
394
396
  ...size,
395
- orientation
397
+ orientation,
398
+ isCurrentOrientation: false
396
399
  };
397
400
  if (shouldCache) this.cachedScreenSize = result;
398
401
  return result;
@@ -478,8 +481,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
478
481
  const match = (screenSize.override || screenSize.physical).match(/(\d+)x(\d+)/);
479
482
  if (!match || match.length < 3) throw new Error(`Unable to parse screen size: ${screenSize}`);
480
483
  const isLandscape = 1 === screenSize.orientation || 3 === screenSize.orientation;
481
- const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
482
- const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
484
+ const shouldSwap = true !== screenSize.isCurrentOrientation && isLandscape;
485
+ const width = Number.parseInt(match[shouldSwap ? 2 : 1], 10);
486
+ const height = Number.parseInt(match[shouldSwap ? 1 : 2], 10);
483
487
  const scale = (null == (_this_options = this.options) ? void 0 : _this_options.screenshotResizeScale) ?? 1 / this.devicePixelRatio;
484
488
  this.scalingRatio = scale;
485
489
  const logicalWidth = Math.round(width * scale);
@@ -76,6 +76,7 @@ export declare class AndroidDevice implements AbstractInterface {
76
76
  override: string;
77
77
  physical: string;
78
78
  orientation: number;
79
+ isCurrentOrientation?: boolean;
79
80
  }>;
80
81
  private initializeDevicePixelRatio;
81
82
  getDisplayDensity(): Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "1.0.1-beta-20251104101357.0",
3
+ "version": "1.0.1-beta-20251107042357.0",
4
4
  "description": "Android automation library for Midscene",
5
5
  "keywords": [
6
6
  "Android UI automation",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "appium-adb": "12.12.1",
30
- "@midscene/shared": "1.0.1-beta-20251104101357.0",
31
- "@midscene/core": "1.0.1-beta-20251104101357.0"
30
+ "@midscene/shared": "1.0.1-beta-20251107042357.0",
31
+ "@midscene/core": "1.0.1-beta-20251107042357.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@rslib/core": "^0.11.2",
@@ -38,7 +38,7 @@
38
38
  "tsx": "^4.19.2",
39
39
  "vitest": "3.0.5",
40
40
  "zod": "3.24.3",
41
- "@midscene/playground": "1.0.1-beta-20251104101357.0"
41
+ "@midscene/playground": "1.0.1-beta-20251107042357.0"
42
42
  },
43
43
  "license": "MIT",
44
44
  "scripts": {