Scene builder: прилипание добавляемого объекта к сетке и другим объектам
This commit is contained in:
parent
6732d5a98f
commit
40b9b116c1
31 changed files with 1193 additions and 46 deletions
|
@ -1,9 +1,11 @@
|
|||
import { ArrayExtensions } from "./array";
|
||||
import { MapExtensions } from "./map";
|
||||
import { NumberExtensions } from "./number";
|
||||
import { StringExtensions } from "./string";
|
||||
|
||||
export type CallBackVoidFunction = <T>(value: T) => void;
|
||||
export type CallBackStringVoidFunction = (value: string) => void;
|
||||
export type CallBackEventTarget = (value: EventTarget) => void;
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
|
@ -14,6 +16,9 @@ declare global {
|
|||
isNotEmpty(): boolean;
|
||||
hasIncludeElement(element: T): boolean;
|
||||
}
|
||||
interface Number {
|
||||
fromArray(): number[];
|
||||
}
|
||||
interface String {
|
||||
isEmpty(): boolean;
|
||||
isNotEmpty(): boolean;
|
||||
|
@ -21,9 +26,11 @@ declare global {
|
|||
interface Map<K, V> {
|
||||
addValueOrMakeCallback(key: K, value: V, callBack: CallBackVoidFunction): void;
|
||||
}
|
||||
interface Vector3 {}
|
||||
}
|
||||
export const extensions = () => {
|
||||
ArrayExtensions();
|
||||
StringExtensions();
|
||||
NumberExtensions();
|
||||
MapExtensions();
|
||||
};
|
||||
|
|
8
ui/src/core/extensions/number.ts
Normal file
8
ui/src/core/extensions/number.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export const NumberExtensions = () => {
|
||||
if (Number().fromArray === undefined) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Number.prototype.fromArray = function () {
|
||||
return Array.from(this.toString()).map((el) => Number(el));
|
||||
};
|
||||
}
|
||||
};
|
7
ui/src/core/extensions/object.ts
Normal file
7
ui/src/core/extensions/object.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* eslint-disable no-extend-native */
|
||||
|
||||
export const ObjectExtensionsIsKeyExists = (obj: any, keys: string[]): boolean => {
|
||||
return true;
|
||||
};
|
||||
|
||||
// {"objectThatSticksName":"cube2","objectThatSticksNamePoints":[{"x":25,"y":4.987889622413917,"z":10.504078531217838}],"objectsToWhichItSticksName":"cube1","objectsToWhichItSticksPoints":[{"x":5,"y":3.0783236330074963,"z":1.1333166084347885}]}
|
Loading…
Add table
Add a link
Reference in a new issue