spatial-calculation-ui-layout

Calculate UI positions and measure text widths for Phaser games and web apps.

2|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/pmarashian/cursor-agent-skills --skill spatial-calculation-ui-layout
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spatial-calculation-ui-layout
Source: https://github.com/pmarashian/cursor-agent-skills/tree/main/spatial-calculation-ui-layout
Command: npx skills add https://github.com/pmarashian/cursor-agent-skills --skill spatial-calculation-ui-layout

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common challenge of UI positioning in game development and web applications, reducing the typical 3-5 iteration cycles to just 1-2.

Core Features & Use Cases

  • Coordinate System Clarity: Differentiates and explains world vs. screen coordinates, crucial for accurate placement.
  • Text Measurement Utilities: Provides patterns to accurately measure text width before positioning elements.
  • Layout Calculation Patterns: Offers reusable patterns for centering text, positioning relative to other objects, and responsive layouts.
  • Use Case: When developing a game UI, use this Skill to precisely center a score display or position a button below a dynamic text element, ensuring pixel-perfect alignment on the first try.

Quick Start

Use the spatial-calculation-ui-layout skill to center the text element 'welcomeMessage' on the screen.

Frequently Asked Questions about spatial-calculation-ui-layout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate text width before positioning UI elements in Phaser?

To calculate text width for UI positioning in Phaser, you need measurement utilities that determine dimensions before rendering. This Skill provides text measurement patterns to accurately calculate text width, enabling pixel-perfect element alignment on the first attempt.

What is the difference between world and screen coordinates for game UI layout?

World and screen coordinates differ in their reference origin for game UI layout. World coordinates map to the game's global space, while screen coordinates map to the viewport, and this Skill clarifies converting between them for accurate UI element placement.

How do I center a text element on the screen in a Phaser game?

Centering a text element on the screen in a Phaser game requires calculating the screen midpoint and offsetting by the text's measured dimensions. This Skill provides reusable layout calculation patterns to center text and position elements relative to objects.

Does this UI layout calculation approach work for web applications outside of game development?

Yes, this UI layout calculation approach works for web applications outside of game development. The spatial calculation helpers and coordinate system patterns are applicable to both Phaser games and general web applications requiring precise element positioning.

Why does my game UI positioning require multiple iteration cycles to align correctly?

Game UI positioning requires multiple iteration cycles when text measurement and coordinate systems are not calculated beforehand. This Skill reduces UI positioning iterations from 3-5 down to 1-2 by providing spatial calculation helpers and layout patterns.