@wonder-partners/ar-button
Advanced tools
Comparing version 0.4.0 to 0.5.0
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
@@ -7,2 +8,8 @@ | ||
## [0.5.0] 2022-08-08 | ||
### Added | ||
- `allows-content-scaling` attribute for iOS. If set to 0, disables the pinch scaling feature. If omitted, default is 1 (pinch scaling feature enabled). | ||
## [0.4.0] 2022-08-05 | ||
@@ -31,2 +38,2 @@ | ||
- `<ar-button>` component. | ||
- `<ar-button>` component. |
@@ -53,2 +53,3 @@ // @ts-check | ||
const canonicalWebPageURL = button.getAttribute('canonical-web-page-url'); | ||
const allowsContentScaling = button.getAttribute('allows-content-scaling'); | ||
@@ -76,2 +77,6 @@ href = `${src}#`; | ||
} | ||
if (allowsContentScaling === '0') { | ||
href += '&allowsContentScaling=0'; | ||
} | ||
} else if (isMobile.Android()) { | ||
@@ -78,0 +83,0 @@ button.setAttribute('ar', 'scene-viewer'); |
{ | ||
"name": "@wonder-partners/ar-button", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "A web component to easily display 3D models in native AR across browsers and mobile devices", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# AR Button | ||
A web-component to display a 3D model in augmented reality using the native [Quick Look](https://developer.apple.com/documentation/arkit/previewing_a_model_with_ar_quick_look) on iOS and [Scene Viewer](https://developers.google.com/ar/develop/java/scene-viewer) on Android. Heavily inspired by [model-viewer](https://modelviewer.dev/) and [@leoncvlt/ar-button](https://leoncvlt.github.io/ar-button/). | ||
@@ -8,12 +9,16 @@ | ||
<!-- Import the component --> | ||
<script type="module" src="https://unpkg.com/@wonder-partners/ar-button"></script> | ||
<script | ||
type="module" | ||
src="https://unpkg.com/@wonder-partners/ar-button" | ||
></script> | ||
<!-- Default stylesheet (optional) --> | ||
<link rel="stylesheet" href="https://unpkg.com/@wonder-partners/ar-button/styles.css"> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/@wonder-partners/ar-button/styles.css" | ||
/> | ||
<!-- Use it like any other HTML element --> | ||
<ar-button | ||
src="https://your.model.glb" | ||
ios-src="https://your.model.usdz"> | ||
View in your space | ||
<ar-button src="https://your.model.glb" ios-src="https://your.model.usdz"> | ||
View in your space | ||
</ar-button> | ||
@@ -24,44 +29,48 @@ ``` | ||
**`src` → *uri* (Android)** | ||
**`src` → _uri_ (Android)** | ||
The URL to the 3D model for Android platform. Only glTF/GLB models are supported. | ||
**`title` → *string* (Android)** | ||
**`title` → _string_ (Android)** | ||
A name for the model. If present, it will be displayed in the UI. The name will be truncated with ellipses after 60 characters. | ||
A name for the model. If present, it will be displayed in the UI. The name will be truncated with ellipses after 60 characters. | ||
**`fallback-url` → *uri* (Android)** | ||
**`fallback-url` → _uri_ (Android)** | ||
When the [Google app](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox) is not present on the device, this is the URL that the browser navigates to. | ||
**`occlusion` → *boolean* (Android)** | ||
**`occlusion` → _boolean_ (Android)** | ||
If present, turns on Object blending mode. | ||
**`link` → *uri* (Android, iOS)** | ||
**`link` → _uri_ (Android, iOS)** | ||
A URL for an external webpage. If present, a button will be surfaced in the UI that intents to this URL when clicked. | ||
**`ios-src` → *uri* (iOS)** | ||
**`ios-src` → _uri_ (iOS)** | ||
The URL to the 3D model for iOS platform. Only USDZ models are supported. | ||
**`checkout-title` → *string* (iOS)** | ||
**`checkout-title` → _string_ (iOS)** | ||
A name for the model. If present, it will be displayed in the UI. Only works if supplied alongside `checkout-subtitle`, `price`, and `call-to-action`. | ||
**`checkout-subtitle` → *string* (iOS)** | ||
**`checkout-subtitle` → _string_ (iOS)** | ||
If present, it will be displayed in the UI. Only works if supplied alongside `checkout-subtitle`, `price`, and `call-to-action`. | ||
If present, it will be displayed in the UI. Only works if supplied alongside `checkout-subtitle`, `price`, and `call-to-action`. | ||
**`price` → *string* (iOS)** | ||
**`price` → _string_ (iOS)** | ||
If present, it will be displayed in the UI. Only works if supplied alongside `checkout-subtitle`, `price`, and `call-to-action`. AR Quick Look displays the subtitle and price separated by a comma below the title. Price should include the currency symbol. | ||
**`call-to-action` → *string* (iOS)** | ||
**`call-to-action` → _string_ (iOS)** | ||
If present, display this text as a button the quick look default UI. Only works when supplied alongside `checkout-title`, `checkout-subtitle` and `price`. You should also supply an url to `link` (see above). | ||
**`canonical-web-page-url` → *uri* (iOS)** | ||
**`canonical-web-page-url` → _uri_ (iOS)** | ||
If present, this URL will be used inside the native *Share* button of AR QuickLook. | ||
If present, this URL will be used inside the native _Share_ button of AR QuickLook. | ||
**`allows-content-scaling` → _int_ (iOS)** | ||
If set to 0, disables the pinch scaling feature. If omitted, default to 1 (pinch scaling feature enabled). |
82273
157
75