Token导航 LogoToken导航

Agent Skill · 待分类

scale-and-responsive(规模和响应能力)

scale-and-responsive 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

scale-and-responsive 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 3,369。

总安装 1,038周安装 42GitHub Stars 39,492下载 326核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:scale-and-responsive(规模和响应能力)
来源仓库:https://github.com/phaserjs/phaser
仓库路径:skills/scale-and-responsive
安装命令:
npx skills add https://github.com/phaserjs/phaser --skill scale-and-responsive
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/phaserjs/phaser --skill scale-and-responsive

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

scale-and-responsive 提供游戏或界面缩放与适配策略。适用于 Phaser.js 等项目中实现多分辨率兼容。通过 npx skills add 命令从 phaser 仓库安装调用。需测试不同设备与浏览器下的渲染一致性。

scale-and-responsive 属于待分类类 Skill,可作为该场景下的辅助能力补充。建议采用相对单位与媒体查询结合的方式提升适应性。

来源仓库内路径:skills/scale-and-responsive

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/phaserjs/phaser --skill scale-and-responsive;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

scale-and-responsive 怎么安装?

在终端执行 npx skills add https://github.com/phaserjs/phaser --skill scale-and-responsive。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

scale-and-responsive 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

scale-and-responsive 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

scale-and-responsive 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

scale-and-responsive 用的人多吗?

公开数据是累计安装 1,038 次,近一周安装 42 次,下载 326 次,GitHub 39,492 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

scale-and-responsive 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 39,492 星,维护活跃度相对可查。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
scale-and-responsive

规模和响应能力 · 本页

1,03839,492操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Scale and Responsive Design

How to use the ScaleManager for scaling, centering, fullscreen, orientation handling, and responsive resize in Phaser 4.

Key source paths: src/scale/ScaleManager.js, src/scale/const/, src/scale/events/, src/core/typedefs/ScaleConfig.js Related skills:../game-setup-and-config/SKILL.md

Quick Start

Scale-to-fit with centering -- the most common setup for responsive games:

const config = {
    type: Phaser.AUTO,
    scale: {
        parent: 'game-container',
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        width: 800,
        height: 600
    },
    scene: MyScene
};

const game = new Phaser.Game(config);

The scale config object is parsed into a Phaser.Core.Config instance which the ScaleManager reads during boot. The ScaleManager sets the canvas element size and applies CSS scaling to fit it within its parent.

Core Concepts

ScaleManager (src/scale/ScaleManager.js)

The ScaleManager is created during the Game boot sequence and is accessible at game.scale or this.scale from within a Scene. It extends EventEmitter.

Three internal Size components drive all calculations:

ComponentPropertyPurpose
gameSizegame.scale.gameSizeThe unmodified game dimensions from config. Used for world bounds, cameras. Read via game.scale.width / game.scale.height.
baseSizegame.scale.baseSizeThe auto-rounded gameSize. Sets the actual canvas.width and canvas.height attributes.
displaySizegame.scale.displaySizeThe CSS-scaled canvas size after applying scale mode, parent bounds, and zoom. Sets canvas.style.width / canvas.style.height.

Scaling works by keeping the canvas element dimensions fixed (baseSize) and stretching it via CSS properties (displaySize). This is equivalent to CSS transform-scale but without browser prefix issues.

The displayScale property (Phaser.Math.Vector2) holds the ratio baseSize / canvasBounds and is used internally for input coordinate transformation.

Scale Modes (src/scale/const/SCALE_MODE_CONST.js)

All modes are on Phaser.Scale.ScaleModes and are set via scale.mode in config:

ConstantValueBehavior
NONE0No automatic scaling. Canvas uses config width/height. You manage sizing yourself. If you resize the canvas externally, call game.scale.resize(w, h) to update internals.
WIDTH_CONTROLS_HEIGHT1Height adjusts automatically to maintain aspect ratio based on width.
HEIGHT_CONTROLS_WIDTH2Width adjusts automatically to maintain aspect ratio based on height.
FIT3Scales to fit inside parent while preserving aspect ratio. May leave empty space (letterbox/pillarbox). Most commonly used mode.
ENVELOP4Scales to cover the entire parent while preserving aspect ratio. May extend beyond parent bounds (content gets cropped).
RESIZE5Canvas element itself is resized to fill parent. No CSS scaling -- 1:1 pixel mapping. The gameSize, baseSize, and displaySize all change to match parent. Beware of GPU fill-rate on large displays.
EXPAND6Hybrid of RESIZE and FIT. The visible area resizes to fill the parent, and the canvas scales to fit inside that area. Added in v3.80.

Shorthand constants are also available directly on Phaser.Scale: Phaser.Scale.FIT, Phaser.Scale.RESIZE, etc.

Center Modes (src/scale/const/CENTER_CONST.js)

Set via scale.autoCenter in config. Centering is achieved by setting CSS marginLeft and marginTop on the canvas:

ConstantValueBehavior
NO_CENTER0No auto-centering (default).
CENTER_BOTH1Center horizontally and vertically within parent.
CENTER_HORIZONTALLY2Center horizontally only.
CENTER_VERTICALLY3Center vertically only.

The parent element must have calculable bounds. If the parent has no defined width/height, centering will not work correctly.

Zoom (src/scale/const/ZOOM_CONST.js)

Set via scale.zoom in config. Multiplies the display size:

ConstantValueBehavior
NO_ZOOM1No zoom (default).
ZOOM_2X22x zoom -- good for pixel art at low base resolution.
ZOOM_4X44x zoom.
MAX_ZOOM-1Automatically calculates the largest integer zoom that fits in the parent.

You can also pass any numeric value. The zoom affects CSS display size but not the canvas resolution.

Orientation (src/scale/const/ORIENTATION_CONST.js)

Read via game.scale.orientation. Values are strings:

  • Phaser.Scale.Orientation.LANDSCAPE = 'landscape-primary'
  • Phaser.Scale.Orientation.LANDSCAPE_SECONDARY = 'landscape-secondary'
  • Phaser.Scale.Orientation.PORTRAIT = 'portrait-primary'
  • Phaser.Scale.Orientation.PORTRAIT_SECONDARY = 'portrait-secondary'

Convenience booleans: game.scale.isPortrait, game.scale.isLandscape (device orientation), game.scale.isGamePortrait, game.scale.isGameLandscape (game dimensions).

Common Patterns

FIT Mode with Centering (Most Common)

scale: {
    parent: 'game-container',
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 1280,
    height: 720
}

The game maintains its 16:9 aspect ratio and centers within the parent. Empty space appears as letterbox/pillarbox bars. Style the parent's background color to control bar appearance.

Responsive Resize (Dynamic Canvas Size)

scale: {
    parent: 'game-container',
    mode: Phaser.Scale.RESIZE,
    width: '100%',
    height: '100%'
}
// In your scene -- respond to size changes:
create() {
    this.scale.on('resize', this.handleResize, this);
}

handleResize(gameSize, baseSize, displaySize) {
    this.cameras.resize(gameSize.width, gameSize.height);
    // Reposition UI elements based on new dimensions
}

Width/height accept percentage strings (e.g., '100%') which resolve against the parent size. If the parent has no size, they fall back to window.innerWidth / window.innerHeight.

Fullscreen Toggle

// Must be called from a pointerup gesture (not pointerdown)
this.input.on('pointerup', () => {
    if (this.scale.isFullscreen) {
        this.scale.stopFullscreen();
    } else {
        this.scale.startFullscreen();
    }
});

// Or use the convenience method:
this.input.on('pointerup', () => {
    this.scale.toggleFullscreen();
});
  • startFullscreen(fullscreenOptions) -- requests browser fullscreen. Default options: {navigationUI: 'hide'}.
  • stopFullscreen() -- exits fullscreen mode.
  • toggleFullscreen(fullscreenOptions) -- toggles between the two.
  • isFullscreen -- read-only boolean for current state.

If no fullscreenTarget is configured, Phaser creates a temporary <div>, moves the canvas into it, and sends that div fullscreen. The div is removed when leaving fullscreen.

For iframes, the allowfullscreen attribute is required.

Mobile Orientation Handling

create() {
    this.scale.on('orientationchange', (orientation) => {
        if (orientation === Phaser.Scale.LANDSCAPE) {
            // Show game UI
        } else {
            // Show "rotate device" message
        }
    });

    // Lock orientation (mobile browsers only, limited support):
    this.scale.lockOrientation('landscape');
}

Fixed Size (No Scaling)

scale: {
    mode: Phaser.Scale.NONE,
    width: 800,
    height: 600
}

In NONE mode, if you change the canvas size externally you must call game.scale.resize(newWidth, newHeight) to update all internal components including input coordinates.

Pixel Art with Max Zoom

scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 320,
    height: 240,
    zoom: Phaser.Scale.MAX_ZOOM
},
pixelArt: true

MAX_ZOOM calculates the largest integer multiplier that fits in the parent. Combined with pixelArt: true (which disables anti-aliasing), this gives crisp pixel rendering.

Snap Values for Grid Alignment

scale: {
    mode: Phaser.Scale.FIT,
    width: 800,
    height: 600,
    snap: { width: 16, height: 16 }
}

When the browser resizes, dimensions snap down to the nearest grid multiple (using floor). Best used with FIT mode. Can also be set at runtime: game.scale.setSnap(16, 16) or reset with game.scale.setSnap().

Min/Max Size Constraints

scale: {
    mode: Phaser.Scale.FIT,
    width: 800,
    height: 600,
    min: { width: 400, height: 300 },
    max: { width: 1600, height: 1200 }
}

The display size is clamped to these bounds during scaling calculations.

Configuration Reference

ScaleConfig (src/core/typedefs/ScaleConfig.js)

All properties go inside the scale object in your game config:

PropertyTypeDefaultDescription
width`number\string`1024Base game width. Strings like '100%' resolve against parent size.
height`number\string`768Base game height. Strings like '100%' resolve against parent size.
zoom`number\ZoomType`1Canvas zoom factor. Use Phaser.Scale.MAX_ZOOM for auto.
parent`HTMLElement\string\null`undefinedParent DOM element or its ID. undefined = document.body. null = no parent (you manage canvas placement).
expandParentbooleantrueAllow ScaleManager to set parent/body CSS height to 100%.
modeScaleModeTypeNONEScale mode constant (see table above).
min{width, height}-Minimum canvas dimensions.
max{width, height}-Maximum canvas dimensions.
snap{width, height}-Snap values for resize rounding.
autoRoundbooleanfalseFloor display/style sizes for low-powered device performance.
autoCenterCenterTypeNO_CENTERAuto-centering mode (see table above).
resizeIntervalnumber500Milliseconds between parent size checks (fallback polling).
fullscreenTarget`HTMLElement\string`undefinedElement to send fullscreen. If not set, Phaser creates a wrapper div.

Events (src/scale/events/)

All events are on Phaser.Scale.Events and are emitted by the ScaleManager instance (game.scale):

EventString ValueCallback SignatureWhen
RESIZE'resize'(gameSize, baseSize, displaySize, previousWidth, previousHeight)Any resize, refresh, or scale change. The three Size parameters have .width, .height, .aspectRatio.
ORIENTATION_CHANGE'orientationchange'(orientation)Device orientation changes. orientation is a string constant from Phaser.Scale.Orientation.
ENTER_FULLSCREEN'enterfullscreen'()Browser successfully enters fullscreen.
LEAVE_FULLSCREEN'leavefullscreen'()Browser leaves fullscreen (via code or user ESC).
FULLSCREEN_FAILED'fullscreenfailed'(error)Fullscreen request was denied by the browser.
FULLSCREEN_UNSUPPORTED'fullscreenunsupported'()Browser does not support the Fullscreen API.

API Quick Reference

Key Properties (read-only unless noted)

PropertyTypeDescription
widthnumberGame width (from gameSize.width).
heightnumberGame height (from gameSize.height).
isFullscreenbooleanCurrently in fullscreen mode.
isPortraitbooleanDevice is in portrait orientation.
isLandscapebooleanDevice is in landscape orientation.
isGamePortraitbooleanGame dimensions are taller than wide.
isGameLandscapebooleanGame dimensions are wider than tall.
scaleModenumberCurrent scale mode constant.
orientationstringCurrent orientation string.
zoomnumberCurrent zoom factor.
autoRoundbooleanWhether sizes are auto-floored.
autoCenternumberCurrent center mode constant.
parentSizeSizeComputed parent dimensions.
gameSizeSizeUnmodified game dimensions.
baseSizeSizeCanvas element dimensions.
displaySizeSizeCSS-scaled display dimensions.
displayScaleVector2Ratio of baseSize to canvasBounds (used for input mapping).
canvasHTMLCanvasElementThe game canvas element.
canvasBoundsRectangleDOM bounding rect of the canvas.
parentHTMLElementThe parent DOM element.
parentIsWindowbooleanTrue if parent is document.body.
resizeIntervalnumberPolling interval in ms (writable).

Key Methods

MethodReturnsDescription
resize(width, height)thisFor NONE mode: sets game, base, and display sizes directly. Updates canvas element and CSS.
setGameSize(width, height)thisFor scaled modes (FIT, etc.): changes the base game size and re-applies scaling.
setParentSize(width, height)thisManually set parent dimensions (useful when parent: null).
setZoom(value)thisChange zoom factor at runtime.
setMaxZoom()thisSet zoom to maximum integer that fits parent.
setSnap(snapWidth, snapHeight)thisSet or reset snap grid values.
getMaxZoom()numberCalculate (but don't apply) the max zoom.
getViewPort(camera?, out?)RectangleGet the visible area rectangle, optionally for a specific camera.
refresh(prevW?, prevH?)thisForce recalculation of scale, bounds, orientation. Emits RESIZE.
startFullscreen(options?)voidEnter fullscreen. Must be called from pointerup.
stopFullscreen()voidExit fullscreen.
toggleFullscreen(options?)voidToggle fullscreen state.
lockOrientation(orientation)booleanAttempt to lock screen orientation (mobile only).
transformX(pageX)numberConvert DOM pageX to game coordinate.
transformY(pageY)numberConvert DOM pageY to game coordinate.
getParentBounds()booleanRecalculate parent size. Returns true if changed.
updateCenter()voidRecalculate and apply centering margins.
updateBounds()voidUpdate canvasBounds from the canvas bounding client rect.

Gotchas

  1. Parent element must have dimensions. The ScaleManager relies on the parent's computed CSS size. An unstyled <div> has zero height, which breaks centering and scaling. Either give it explicit CSS dimensions or let expandParent: true (the default) set body/parent to 100% height.
  2. No padding on the parent. The ScaleManager does not account for parent padding. Apply padding to a wrapper element instead, or use margins on the parent's parent.
  3. Do not style the canvas directly. The ScaleManager controls canvas.style.width, canvas.style.height, marginLeft, and marginTop. External CSS on the canvas will conflict.
  4. Fullscreen requires pointerup, not pointerdown. On touch devices, pointerdown fullscreen requests are blocked unless the document already received touch input. Always use pointerup for reliable behavior.
  5. Fullscreen in iframes needs allowfullscreen. Without this attribute on the iframe element, fullscreen requests will silently fail.
  6. RESIZE mode and GPU fill-rate. RESIZE creates a 1:1 pixel canvas matching the parent. On high-resolution displays this can be very large. Monitor performance on low-end devices.
  7. resize() vs setGameSize(). Use resize() only in NONE mode (it sets everything directly). Use setGameSize() when using FIT/ENVELOP/etc. (it preserves the scale mode calculations).
  8. iOS height quirks. When the parent is the window on iOS, the ScaleManager uses GetInnerHeight to work around Safari's dynamic toolbar affecting getBoundingClientRect.
  9. Percentage strings require a sized parent. Setting width: '100%' or height: '100%' resolves against parentSize. If the parent has no size, it falls back to window.innerWidth/innerHeight.
  10. resizeInterval is a fallback poll. Modern browsers dispatch resize events, but the ScaleManager also polls every resizeInterval ms (default 500) to catch edge cases on older browsers.

Source File Map

FilePurpose
src/scale/ScaleManager.jsMain class -- all scaling, centering, fullscreen, orientation logic. Access via game.scale.
src/scale/const/SCALE_MODE_CONST.jsScale mode constants: NONE, WIDTH_CONTROLS_HEIGHT, HEIGHT_CONTROLS_WIDTH, FIT, ENVELOP, RESIZE, EXPAND.
src/scale/const/CENTER_CONST.jsCenter mode constants: NO_CENTER, CENTER_BOTH, CENTER_HORIZONTALLY, CENTER_VERTICALLY.
src/scale/const/ZOOM_CONST.jsZoom constants: NO_ZOOM, ZOOM_2X, ZOOM_4X, MAX_ZOOM.
src/scale/const/ORIENTATION_CONST.jsOrientation string constants: LANDSCAPE, LANDSCAPE_SECONDARY, PORTRAIT, PORTRAIT_SECONDARY.
src/scale/events/RESIZE_EVENT.jsResize event definition. Callback receives gameSize, baseSize, displaySize, previousWidth, previousHeight.
src/scale/events/ENTER_FULLSCREEN_EVENT.jsEmitted on successful fullscreen entry.
src/scale/events/LEAVE_FULLSCREEN_EVENT.jsEmitted when leaving fullscreen.
src/scale/events/FULLSCREEN_FAILED_EVENT.jsEmitted when fullscreen request is denied.
src/scale/events/FULLSCREEN_UNSUPPORTED_EVENT.jsEmitted when browser lacks Fullscreen API support.
src/scale/events/ORIENTATION_CHANGE_EVENT.jsEmitted on device orientation change. Callback receives orientation string.
src/core/typedefs/ScaleConfig.jsJSDoc typedef for the scale config object.
src/structs/Size.jsThe Size component class used by gameSize, baseSize, displaySize.
src/dom/GetInnerHeight.jsiOS-specific workaround for getting accurate viewport height.
src/dom/GetScreenOrientation.jsDetermines current screen orientation from dimensions.

平台分布

Codex

34.38%
按下载量换算112

Claude

29.6%
按下载量换算96

Cursor

17.16%
按下载量换算56

Gemini CLI

9.96%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills