Skip to content

feat(@typegpu/react) Listen for canvas size changes, and resize (on React Native) #2460

@iwoplaza

Description

@iwoplaza
const attachResizing = useEffectEvent((el: HTMLCanvasElement | OffscreenCanvas | null) => {
  // TODO(#2460): Listen for size changes and resize canvas
  if (el && 'clientWidth' in el) {
    el.width = el.clientWidth * PixelRatio.get();
    el.height = el.clientHeight * PixelRatio.get();
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions