@limrun/ui 0.5.1 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limrun/ui",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -7,6 +7,8 @@ import { ANDROID_KEYS, AMOTION_EVENT, codeMap } from '../core/constants';
7
7
  import iphoneFrameImage from '../assets/iphone16pro_black_bg.webp';
8
8
  import pixelFrameImage from '../assets/pixel9_black.webp';
9
9
  import pixelFrameImageLandscape from '../assets/pixel9_black_landscape.webp';
10
+ import pixelTabletFrameImage from '../assets/pixel_tablet_portrait.webp';
11
+ import pixelTabletFrameImageLandscape from '../assets/pixel_tablet_landscape.webp';
10
12
  import iphoneFrameImageLandscape from '../assets/iphone16pro_black_landscape_bg.webp';
11
13
  import appleLogoSvg from '../assets/Apple_logo_white.svg';
12
14
  import androidBootImage from '../assets/android_boot.webp';
@@ -115,6 +117,13 @@ type DeviceConfig = {
115
117
  }
116
118
  }
117
119
 
120
+ const ANDROID_TABLET_VIDEO_WIDTH = 1920;
121
+ const ANDROID_TABLET_VIDEO_HEIGHT = 1200;
122
+
123
+ const isAndroidTabletVideo = (width: number, height: number): boolean =>
124
+ (width === ANDROID_TABLET_VIDEO_WIDTH && height === ANDROID_TABLET_VIDEO_HEIGHT) ||
125
+ (width === ANDROID_TABLET_VIDEO_HEIGHT && height === ANDROID_TABLET_VIDEO_WIDTH);
126
+
118
127
  // Device-specific configuration for frame sizing and video positioning
119
128
  // Video position percentages are relative to the frame image dimensions
120
129
  const deviceConfig: Record<DevicePlatform, DeviceConfig> = {
@@ -185,6 +194,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
185
194
  const frameRef = useRef<HTMLImageElement>(null);
186
195
  const [videoLoaded, setVideoLoaded] = useState(false);
187
196
  const [isLandscape, setIsLandscape] = useState(false);
197
+ const [useAndroidTabletFrame, setUseAndroidTabletFrame] = useState(false);
188
198
  const [videoStyle, setVideoStyle] = useState<React.CSSProperties>({});
189
199
  const wsRef = useRef<WebSocket | null>(null);
190
200
  const peerConnectionRef = useRef<RTCPeerConnection | null>(null);
@@ -1397,6 +1407,9 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
1397
1407
  // Determine landscape based on video's intrinsic dimensions
1398
1408
  const landscape = video.videoWidth > video.videoHeight;
1399
1409
  setIsLandscape(landscape);
1410
+ setUseAndroidTabletFrame(
1411
+ platform === 'android' && isAndroidTabletVideo(video.videoWidth, video.videoHeight),
1412
+ );
1400
1413
 
1401
1414
  const pos = landscape ? config.videoPosition.landscape : config.videoPosition.portrait;
1402
1415
  let newStyle: React.CSSProperties = {};
@@ -1589,6 +1602,10 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
1589
1602
 
1590
1603
  // Show indicators when Alt is held and we have a valid hover point (null when outside)
1591
1604
  const showAltIndicators = isAltHeld && hoverPoint !== null;
1605
+ const frameImageSrc =
1606
+ platform === 'android' && useAndroidTabletFrame
1607
+ ? (isLandscape ? pixelTabletFrameImageLandscape : pixelTabletFrameImage)
1608
+ : (isLandscape ? config.frame.imageLandscape : config.frame.image);
1592
1609
 
1593
1610
  return (
1594
1611
  <div
@@ -1630,7 +1647,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
1630
1647
  {showFrame && (
1631
1648
  <img
1632
1649
  ref={frameRef}
1633
- src={isLandscape ? config.frame.imageLandscape : config.frame.image}
1650
+ src={frameImageSrc}
1634
1651
  alt=""
1635
1652
  className={platform === 'ios' ? clsx('rc-phone-frame', 'rc-phone-frame-ios') : 'rc-phone-frame'}
1636
1653
  draggable={false}