@midscene/android 0.30.7 → 0.30.8-beta-20251103084157.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
@@ -312,7 +312,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
312
312
  const result = {
313
313
  override: sizeStr,
314
314
  physical: sizeStr,
315
- orientation: rotation
315
+ orientation: rotation,
316
+ isCurrentOrientation: true
316
317
  };
317
318
  if (shouldCache) this.cachedScreenSize = result;
318
319
  return result;
@@ -335,7 +336,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
335
336
  const result = {
336
337
  override: sizeStr,
337
338
  physical: sizeStr,
338
- orientation: rotation
339
+ orientation: rotation,
340
+ isCurrentOrientation: true
339
341
  };
340
342
  if (shouldCache) this.cachedScreenSize = result;
341
343
  return result;
@@ -368,7 +370,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
368
370
  if (size.override || size.physical) {
369
371
  const result = {
370
372
  ...size,
371
- orientation
373
+ orientation,
374
+ isCurrentOrientation: false
372
375
  };
373
376
  if (shouldCache) this.cachedScreenSize = result;
374
377
  return result;
@@ -454,8 +457,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
454
457
  const match = (screenSize.override || screenSize.physical).match(/(\d+)x(\d+)/);
455
458
  if (!match || match.length < 3) throw new Error(`Unable to parse screen size: ${screenSize}`);
456
459
  const isLandscape = 1 === screenSize.orientation || 3 === screenSize.orientation;
457
- const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
458
- const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
460
+ const shouldSwap = true !== screenSize.isCurrentOrientation && isLandscape;
461
+ const width = Number.parseInt(match[shouldSwap ? 2 : 1], 10);
462
+ const height = Number.parseInt(match[shouldSwap ? 1 : 2], 10);
459
463
  const scale = (null == (_this_options = this.options) ? void 0 : _this_options.screenshotResizeScale) ?? 1 / this.devicePixelRatio;
460
464
  this.scalingRatio = scale;
461
465
  const logicalWidth = Math.round(width * scale);
package/dist/lib/index.js CHANGED
@@ -358,7 +358,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
358
358
  const result = {
359
359
  override: sizeStr,
360
360
  physical: sizeStr,
361
- orientation: rotation
361
+ orientation: rotation,
362
+ isCurrentOrientation: true
362
363
  };
363
364
  if (shouldCache) this.cachedScreenSize = result;
364
365
  return result;
@@ -381,7 +382,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
381
382
  const result = {
382
383
  override: sizeStr,
383
384
  physical: sizeStr,
384
- orientation: rotation
385
+ orientation: rotation,
386
+ isCurrentOrientation: true
385
387
  };
386
388
  if (shouldCache) this.cachedScreenSize = result;
387
389
  return result;
@@ -414,7 +416,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
414
416
  if (size.override || size.physical) {
415
417
  const result = {
416
418
  ...size,
417
- orientation
419
+ orientation,
420
+ isCurrentOrientation: false
418
421
  };
419
422
  if (shouldCache) this.cachedScreenSize = result;
420
423
  return result;
@@ -500,8 +503,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
500
503
  const match = (screenSize.override || screenSize.physical).match(/(\d+)x(\d+)/);
501
504
  if (!match || match.length < 3) throw new Error(`Unable to parse screen size: ${screenSize}`);
502
505
  const isLandscape = 1 === screenSize.orientation || 3 === screenSize.orientation;
503
- const width = Number.parseInt(match[isLandscape ? 2 : 1], 10);
504
- const height = Number.parseInt(match[isLandscape ? 1 : 2], 10);
506
+ const shouldSwap = true !== screenSize.isCurrentOrientation && isLandscape;
507
+ const width = Number.parseInt(match[shouldSwap ? 2 : 1], 10);
508
+ const height = Number.parseInt(match[shouldSwap ? 1 : 2], 10);
505
509
  const scale = (null == (_this_options = this.options) ? void 0 : _this_options.screenshotResizeScale) ?? 1 / this.devicePixelRatio;
506
510
  this.scalingRatio = scale;
507
511
  const logicalWidth = Math.round(width * scale);
@@ -49,6 +49,7 @@ export declare class AndroidDevice implements AbstractInterface {
49
49
  override: string;
50
50
  physical: string;
51
51
  orientation: number;
52
+ isCurrentOrientation?: boolean;
52
53
  }>;
53
54
  private initializeDevicePixelRatio;
54
55
  getDisplayDensity(): Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "0.30.7",
3
+ "version": "0.30.8-beta-20251103084157.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/core": "0.30.7",
31
- "@midscene/shared": "0.30.7"
30
+ "@midscene/core": "0.30.8-beta-20251103084157.0",
31
+ "@midscene/shared": "0.30.8-beta-20251103084157.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@rslib/core": "^0.11.2",
@@ -37,7 +37,7 @@
37
37
  "typescript": "^5.8.3",
38
38
  "tsx": "^4.19.2",
39
39
  "vitest": "3.0.5",
40
- "@midscene/playground": "0.30.7"
40
+ "@midscene/playground": "0.30.8-beta-20251103084157.0"
41
41
  },
42
42
  "license": "MIT",
43
43
  "scripts": {