XRView: recommendedViewportScale property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Thuộc tính chỉ đọc recommendedViewportScale của giao diện XRView là giá trị tỷ lệ viewport được khuyến nghị mà bạn có thể dùng cho XRView.requestViewportScale() nếu tác nhân người dùng có đề xuất như vậy; null nếu không.

Giá trị

Số lớn hơn 0.0 và nhỏ hơn hoặc bằng 1.0; hoặc null nếu tác nhân người dùng không cung cấp tỷ lệ được khuyến nghị.

Ví dụ

Tỷ lệ viewport động

Tỷ lệ viewport động cho phép các ứng dụng chỉ sử dụng một tập con của framebuffer có sẵn. Tính năng này có thể không khả dụng trên tất cả hệ thống vì nó phụ thuộc vào hỗ trợ driver, vì vậy bạn có thể muốn đảm bảo rằng XRView.requestViewportScale tồn tại trước khi gọi nó.

js
for (const view of pose.views) {
  if (view.requestViewportScale) {
    view.requestViewportScale(view.recommendedViewportScale);
  }
  const viewport = glLayer.getViewport(view);
}

Thông số kỹ thuật

Specification
WebXR Device API
# dom-xrview-recommendedviewportscale

Tương thích trình duyệt

Xem thêm