optimized sqrt function
This commit is contained in:
parent
796b89636d
commit
ab83b33725
3 changed files with 70 additions and 38 deletions
|
|
@ -1,42 +1,46 @@
|
|||
import { AnimationKeyframe } from "../components/AnimationKeyframe.js";
|
||||
import { AnimType } from "../types/enums/AnimType.js";
|
||||
import { KeyframeAnimationProperties } from "../types/properties/element/Animation.js";
|
||||
import { Binding } from "../types/properties/value.js";
|
||||
import { AnimationKeyframe } from "../components/AnimationKeyframe.js"
|
||||
import { AnimType } from "../types/enums/AnimType.js"
|
||||
import { BagBinding } from "../types/enums/BagBinding.js"
|
||||
import { KeyframeAnimationProperties } from "../types/properties/element/Animation.js"
|
||||
import { Binding } from "../types/properties/value.js"
|
||||
import { config } from "./Configuration.js"
|
||||
|
||||
export function FormatProperties(properties: any) {
|
||||
const property_bag: Record<Binding, any> = {};
|
||||
const property_bag: Record<Binding, any> = {}
|
||||
|
||||
for (const key in properties) {
|
||||
const value = properties[key];
|
||||
for (const key in properties) {
|
||||
const value = properties[key]
|
||||
|
||||
if (key.startsWith("#")) {
|
||||
property_bag[<Binding>key] = value;
|
||||
delete properties[key];
|
||||
}
|
||||
}
|
||||
if (key.startsWith("#")) {
|
||||
property_bag[<Binding>key] = value
|
||||
delete properties[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.anchor) {
|
||||
properties.anchor_from = properties.anchor_to = properties.anchor;
|
||||
delete properties.anchor;
|
||||
}
|
||||
if (config.compiler?.fixInventoryItemRenderer && property_bag[BagBinding.ITEM_ID_AUX]) {
|
||||
property_bag[BagBinding.ITEM_ID_AUX] = `(${property_bag[BagBinding.ITEM_ID_AUX]} / 1)`
|
||||
}
|
||||
|
||||
if (Object.keys(property_bag).length) {
|
||||
if (properties.property_bag) {
|
||||
properties.property_bag = { ...property_bag, ...properties.property_bag };
|
||||
} else {
|
||||
properties.property_bag = property_bag;
|
||||
}
|
||||
}
|
||||
if (properties.anchor) {
|
||||
properties.anchor_from = properties.anchor_to = properties.anchor
|
||||
delete properties.anchor
|
||||
}
|
||||
|
||||
return properties;
|
||||
if (Object.keys(property_bag).length) {
|
||||
if (properties.property_bag) {
|
||||
properties.property_bag = { ...property_bag, ...properties.property_bag }
|
||||
} else {
|
||||
properties.property_bag = property_bag
|
||||
}
|
||||
}
|
||||
|
||||
return properties
|
||||
}
|
||||
|
||||
export function FormatAnimationProperties(
|
||||
properties: KeyframeAnimationProperties<AnimType>,
|
||||
) {
|
||||
if (properties.next instanceof AnimationKeyframe) {
|
||||
properties.next = `${properties.next}`;
|
||||
}
|
||||
export function FormatAnimationProperties(properties: KeyframeAnimationProperties<AnimType>) {
|
||||
if (properties.next instanceof AnimationKeyframe) {
|
||||
properties.next = `${properties.next}`
|
||||
}
|
||||
|
||||
return properties;
|
||||
return properties
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue