EditorState beta
Class of @v12-engine/editor
export declare class EditorStateThe 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
constructor(host: {
map: () => Pick<GameMap, 'editor'>;
changed: () => void;
redraw: () => void;
});Constructs a new instance of the EditorState class
addToGroup
addToGroup(id: number, targets: Iterable<Named>): void;Puts things in a group, out of the groups they were in
childGroups
childGroups(parent?: number): EditorGroup[];The groups in a group (one level), or at the top for no id
createGroup
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
data(): EditorMapData;The editor's own data kept with the map, read fresh from it
forgetSelectionSet
forgetSelectionSet(name: string): void;Forgets a selection kept, by its name
forgetView
forgetView(key?: number): void;Forgets the view kept on a number, or every one
group
group(id: number): EditorGroup | undefined;The group of that id, or undefined when there is none
groupOf
groupOf(target: Named): EditorGroup | undefined;The group a thing is in, if any
groups
groups(): EditorGroup[];Every group, as a copy
hidden
hidden(): Named[];The things hidden by themselves (not by isolating)
isHidden
isHidden(target: Named): boolean;Whether a thing is not drawn and not picked: hidden by itself, or outside what is isolated
isLocked
isLocked(target: Named): boolean;Whether a thing is drawn but not picked
isolate
isolate(targets: Iterable<Named>): void;Hides everything but these, until stopIsolating (not kept with the map)
isolatedTargets
isolatedTargets(): Named[];What is isolated: the only things drawn and picked
isolating
get isolating(): boolean;Whether everything but a few is hidden now
keepSelectionSet
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
locked(): Named[];The things locked by themselves
membersOf
membersOf(id: number, deep?: boolean): Named[];The members of a group: its own, and with deep those of the groups in it
prune
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
removeFromGroups(targets: Iterable<Named>): void;Takes things out of whatever group they are in
renameGroup
renameGroup(id: number, name: string): void;Renames a group; an empty name or a missing group changes nothing
renameSelectionSet
renameSelectionSet(name: string, to: string): void;Renames a selection kept: not to the name of another
selectionSet
selectionSet(nameOrKey: string | number): EditorSelectionSet | undefined;A selection kept, by its name or the key it is on
selectionSets
selectionSets(): EditorSelectionSet[];The selections kept with the map, in the order they were first kept
setHidden
setHidden(targets: Iterable<Named>, hidden: boolean): void;Hides things, or shows them again
setLocked
setLocked(targets: Iterable<Named>, locked: boolean): void;Locks things, or lets them go
setView
setView(key: number, pose: CameraPose): void;Keeps a view on a number, with the map
stopIsolating
stopIsolating(): void;Ends isolating: everything that was hidden by it is shown again
ungroup
ungroup(id: number): void;Takes a group away: its members are free, the groups in it go up a level
version
version: number;Goes up on every change: what caches by what is hidden keys on it
view
view(key: number): CameraPose | undefined;The view kept on a number, if there is one
viewKeys
viewKeys(): number[];The numbers views are kept on, in order