Tauri Core API - v2.6.0
    Preparing search index...

    Class LogicalSize

    A size represented in logical pixels. Logical pixels are scaled according to the window's DPI scale. Most browser APIs (i.e. MouseEvent's clientX) will return logical pixels.

    For logical-pixel-based position, see LogicalPosition.

    2.0.0

    Index

    Constructors

    Properties

    type: "Logical" = 'Logical'
    width: number
    height: number

    Methods

    • Converts the logical size to a physical one.

      Parameters

      • scaleFactor: number

      Returns dpi.PhysicalSize

      import { LogicalSize } from '@tauri-apps/api/dpi';
      import { getCurrentWindow } from '@tauri-apps/api/window';

      const appWindow = getCurrentWindow();
      const factor = await appWindow.scaleFactor();
      const size = new LogicalSize(400, 500);
      const physical = size.toPhysical(factor);

      2.0.0

    • Returns { width: number; height: number }

    • Returns { width: number; height: number }