Skip to content

EditorState beta ​

Class of @v12-engine/editor

ts
export declare class EditorState

The editor's own over a map: what is hidden or locked by id (kept with the map), what is isolated (not kept), and the groups. Every change is written to the map's editor table (GameMap.editor, no step of the history), the map told it changed, and redrawn through redraw

Members ​

constructor ​

ts
constructor(host: {
        map: () => Pick<GameMap, 'editor'>;
        changed: () => void;
        redraw: () => void;
    });

Constructs a new instance of the EditorState class

addToGroup ​

ts
addToGroup(id: number, targets: Iterable<Named>): void;

Puts things in a group, out of the groups they were in

childGroups ​

ts
childGroups(parent?: number): EditorGroup[];

The groups in a group (one level), or at the top for no id

createGroup ​

ts
createGroup(members: Iterable<Named>, options?: {
        name?: string;
        parent?: number;
    }): EditorGroup;

Makes a group of things (taken out of the groups they were in), under another when said: nested one level only, so a group in a group takes no more. Called Group n when no name is given

data ​

ts
data(): EditorMapData;

The editor's own data kept with the map, read fresh from it

forgetSelectionSet ​

ts
forgetSelectionSet(name: string): void;

Forgets a selection kept, by its name

forgetView ​

ts
forgetView(key?: number): void;

Forgets the view kept on a number, or every one

group ​

ts
group(id: number): EditorGroup | undefined;

The group of that id, or undefined when there is none

groupOf ​

ts
groupOf(target: Named): EditorGroup | undefined;

The group a thing is in, if any

groups ​

ts
groups(): EditorGroup[];

Every group, as a copy

hidden ​

ts
hidden(): Named[];

The things hidden by themselves (not by isolating)

isHidden ​

ts
isHidden(target: Named): boolean;

Whether a thing is not drawn and not picked: hidden by itself, or outside what is isolated

isLocked ​

ts
isLocked(target: Named): boolean;

Whether a thing is drawn but not picked

isolate ​

ts
isolate(targets: Iterable<Named>): void;

Hides everything but these, until stopIsolating (not kept with the map)

isolatedTargets ​

ts
isolatedTargets(): Named[];

What is isolated: the only things drawn and picked

isolating ​

ts
get isolating(): boolean;

Whether everything but a few is hidden now

keepSelectionSet ​

ts
keepSelectionSet(targets: Iterable<Named>, options?: {
        name?: string;
        key?: number;
    }): EditorSelectionSet;

Keeps things as a selection by a name, on a key where one is said: in the place of one of that name, and the key taken from another on it. A name is made from the key (Selection 3) or the count where none is given

locked ​

ts
locked(): Named[];

The things locked by themselves

membersOf ​

ts
membersOf(id: number, deep?: boolean): Named[];

The members of a group: its own, and with deep those of the groups in it

prune ​

ts
prune(exists: (target: Named) => boolean): void;

Drops what names things that are gone from the map (deleted): hidden, locked, members and the selections kept

removeFromGroups ​

ts
removeFromGroups(targets: Iterable<Named>): void;

Takes things out of whatever group they are in

renameGroup ​

ts
renameGroup(id: number, name: string): void;

Renames a group; an empty name or a missing group changes nothing

renameSelectionSet ​

ts
renameSelectionSet(name: string, to: string): void;

Renames a selection kept: not to the name of another

selectionSet ​

ts
selectionSet(nameOrKey: string | number): EditorSelectionSet | undefined;

A selection kept, by its name or the key it is on

selectionSets ​

ts
selectionSets(): EditorSelectionSet[];

The selections kept with the map, in the order they were first kept

setHidden ​

ts
setHidden(targets: Iterable<Named>, hidden: boolean): void;

Hides things, or shows them again

setLocked ​

ts
setLocked(targets: Iterable<Named>, locked: boolean): void;

Locks things, or lets them go

setView ​

ts
setView(key: number, pose: CameraPose): void;

Keeps a view on a number, with the map

stopIsolating ​

ts
stopIsolating(): void;

Ends isolating: everything that was hidden by it is shown again

ungroup ​

ts
ungroup(id: number): void;

Takes a group away: its members are free, the groups in it go up a level

version ​

ts
version: number;

Goes up on every change: what caches by what is hidden keys on it

view ​

ts
view(key: number): CameraPose | undefined;

The view kept on a number, if there is one

viewKeys ​

ts
viewKeys(): number[];

The numbers views are kept on, in order