Black Trigram (흑괘) - Korean Martial Arts Combat Simulator API - v0.6.0
    Preparing search index...

    Function calculateSafePosition

    • Calculate safe position that prevents clipping at screen edges

      Takes a desired position and element bounds, then ensures the element stays within screen bounds by clamping to safe area.

      Parameters

      • position: [number, number, number]

        Desired 3D position [x, y, z]

      • elementBounds: ElementBounds

        Size of the element

      • screenBounds: ScreenBounds

        Screen size and safe area insets

      Returns SafePosition

      Safe position with clipping prevention

      const safePos = calculateSafePosition(
      [100, 50, 0],
      { width: 200, height: 100, margin: 10 },
      { width: 1920, height: 1080 }
      );
      // Returns: { x: 100, y: 50, wasClamped: false }

      안전위치계산