Skip to content

EditorSelection beta ​

Class of @v12-engine/editor

ts
export declare class EditorSelection

What is selected, and what can be (design review D8): a value with its rules, which tells everyone itself as it changes. What is selected is a set of ids a kind (by the kind's collection, editor.collections), read with ids, has, only, targets and count, and changed only with add, remove, toggle, replace, clear and pick: each change is drawn (the rings), said on the bus (selection) and read again by the panels, with no call to make after. One thing among it can be a tool's (primary): the region of the region tool, the point or path of theirs (and the point of a path, vertex), a sound, a place of the mist, the weather or the clouds. Picking, everything, all of a type; hiding and locking kinds of thing; deleting what is selected.

A part of the editor, as it gives it (editor.selection)

Members ​

constructor ​

ts
constructor(host: SelectionHost);

Constructs a new instance of the EditorSelection class

add ​

ts
add(ids: SelectionIds): void;

Selects these too, of every kind they say

changed ​

ts
protected changed(): void;

After every change: drawn, read again, said

clear ​

ts
clear(): void;

Nothing selected

count ​

ts
count(): number;

How many things are selected, of every kind

deleteMarker ​

ts
deleteMarker(whole?: boolean): void;

Takes away the point picked, or of the path picked the point of it picked, or the whole path when none of its points is, or it has no other

deleteSelection ​

ts
deleteSelection(tell?: boolean): void;

Takes away what is selected, as one step: told with an Undo on it (toast), unless tell is false (a cut)

dropKind ​

ts
dropKind(kind: CollectionId): void;

A kind of the game's own gone from the editor (EditorKinds.remove): nothing of it selected, nor kept

dropMissing ​

ts
dropMissing(): void;

Lets go of what is selected that is not on the map any more, whatever its kind

forgetSet ​

ts
forgetSet(name: string): void;

Forgets a selection kept, by its name

groupOf ​

ts
groupOf(object: MapObject): OutlineGroup;

What kind of thing an object is, for the outliner and for hiding and locking: by what the game says it is

has ​

ts
has(target: Named): boolean;

Whether a thing is selected

ids ​

ts
ids(kind: CollectionId): ReadonlySet<number>;

The ids of a kind that are selected: the same set for as long as the editor is, changed only through the selection

invert ​

ts
invert(): void;

Everything that can be picked and is not selected, selected; what was, let go of

keepSet ​

ts
keepSet(options?: {
        name?: string;
        key?: number;
    }): EditorSelectionSet | undefined;

Keeps what is selected by a name, or on a key from 1 to 9 (Ctrl+Alt and the key): with the map. Nothing for an empty selection

keptSets ​

ts
keptSets(): EditorSelectionSet[];

The selections kept with the map (EditorSelectionSet)

only ​

ts
only(kind: CollectionId): number | undefined;

The one thing of a kind selected, where one alone of it is: nothing for none or several

pick ​

ts
pick(target: Named | null, vertex?: number): void;

A thing picked with its tool (a region, a point, a path and the point of it vertex, a light, a sound, a place of the look): selected alone, and the tool's (primary). Nothing lets go of it, and of everything

primary ​

ts
primary: Named | null;

The one thing of the selection a tool picked (the region tool's region...): nothing when there is none

remove ​

ts
remove(ids: SelectionIds): void;

Lets go of these, of every kind they say

replace ​

ts
replace(ids: SelectionIds): void;

The selection made these and nothing else, of every kind they say

selectAllOf ​

ts
selectAllOf(type: string): void;

Every object of a unit type there is, selected

selected ​

ts
selected(): EditorSelected;

What is selected, as the things themselves (EditorSelected): copies of them as the map has them now, made again only when the selection or the map changed. What a section of the Inspector of a game's own is handed, and what its element reads again when the editor changed

selectedMarkers ​

ts
get selectedMarkers(): SelectedMarkers;

What is selected that is not an object or a camp (which are drawn as the game draws them and moved so), by kind

selectEverything ​

ts
selectEverything(): void;

Everything that can be picked, selected

selectionIds ​

ts
selectionIds(): ByCollection<ReadonlySet<number>>;

The selection, by kind: the sets themselves, to read

selectSet ​

ts
selectSet(nameOrKey: string | number): boolean;

Selects a selection kept, by its name or its key (Alt and the key), of what is still there and can be picked. False when none is

selectWhere ​

ts
selectWhere(query: string): Named[];

Selects what a search by fields finds (where), alone, and says how many. Gives back what it selected

setHidden ​

ts
setHidden(group: OutlineGroup, hidden: boolean): void;

Hides a kind of thing, or shows it again: hidden things are not drawn, and not picked

setLocked ​

ts
setLocked(group: OutlineGroup, locked: boolean): void;

Locks a kind of thing, or lets it go: locked things are drawn but not picked

showTarget ​

ts
showTarget(target: Named, look?: boolean): void;

Selects something of the map, alone, with the select tool, and looks at it (unless look is false)

takes ​

ts
takes(target: Named): boolean;

Whether a thing can be picked: not hidden, not locked

targets ​

ts
targets(): Named[];

Everything selected, as targets, kind by kind

toggle ​

ts
toggle(target: Named): void;

Selects a thing that is not, or lets go of one that is

toolPicked ​

ts
toolPicked(tool: EditorTool): void;

A tool picked: its thing (primary) kept where it is of the tool's kind, let go of otherwise; one thing of its kind selected alone (a region, a point, a path) is what its tool starts on (S27)

version ​

ts
version: number;

Goes up with every change of what is selected: what keys on the selection reads it

vertex ​

ts
vertex: number | undefined;

Of a path picked (primary), the point of it picked, by where it is in the path

where ​

ts
where(query: string): Named[];

What a search by fields finds that can be picked (owner:2 type:footman tag:ranged kind:building name:gate, each held, with words of no field matched against what the Hierarchy calls a thing): as the Hierarchy's search finds it

whereIs ​

ts
whereIs(target: Named): Vec2 | undefined;

Where something of the map is, to look at it: an object, a camp, the middle of a region, a point, a path's start, a doodad