Skip to content

Interface: ScreenLayoutContext ​

Defined in: src/display/SliceLayer.ts:189

Geometry passed to a SliceLayer.layoutScreen implementation.

Properties ​

width ​

ts
width: number;

Defined in: src/display/SliceLayer.ts:191

Viewport width in screen pixels.


height ​

ts
height: number;

Defined in: src/display/SliceLayer.ts:193

Viewport height in screen pixels.


insets ​

ts
insets: object;

Defined in: src/display/SliceLayer.ts:200

Pixels reserved on each edge by other UI (e.g. the slice slider along the bottom). Screen-space layers should keep their content inside the safe area [left, width - right] × [top, height - bottom] so it does not collide with those widgets. Always present; defaults to zero on every edge.

top ​

ts
top: number;
ts
right: number;

bottom ​

ts
bottom: number;

left ​

ts
left: number;

contentRect? ​

ts
optional contentRect?: object;

Defined in: src/display/SliceLayer.ts:212

The part of image-content space the view is fitted to, when the host has set a fit region (see SliceView.setFitRegion). Layers that clip or anchor to "the image" should use this rectangle when present.

x0 ​

ts
x0: number;

y0 ​

ts
y0: number;

x1 ​

ts
x1: number;

y1 ​

ts
y1: number;

Methods ​

project() ​

ts
project(contentX, contentY): object;

Defined in: src/display/SliceLayer.ts:206

Projects a point from image-content space (the pre-scale coordinate space the slice sprite occupies: x along the i-axis, y along the j-axis) to screen pixels, accounting for the current scale, Y-flip, zoom, and pan.

Parameters ​

contentX ​

number

contentY ​

number

Returns ​

object

x ​
ts
x: number;
y ​
ts
y: number;

Released under the MIT License.