Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .prettierignore
100644 → 100755
Empty file.
Empty file modified CODE_OF_CONDUCT.md
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified PRIVACY.md
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified SECURITY.md
100644 → 100755
Empty file.
Empty file modified assets/editor-demo1.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/editor-demo2.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/editor-demo3.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/readme-banner.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified craco-copy-webpack-plugin.js
100644 → 100755
Empty file.
Empty file modified craco-fallback-util-plugin.js
100644 → 100755
Empty file.
Empty file modified craco-service-worker-dev-plugin.js
100644 → 100755
Empty file.
Empty file modified craco.config.js
100644 → 100755
Empty file.
Empty file modified package-lock.json
100644 → 100755
Empty file.
Empty file modified package.json
100644 → 100755
Empty file.
Empty file modified prettier.config.js
100644 → 100755
Empty file.
Empty file modified public/api/version
100644 → 100755
Empty file.
Empty file modified public/index.html
100644 → 100755
Empty file.
Empty file modified public/manifest.json
100644 → 100755
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/precache/favicon.ico
100644 → 100755
Empty file.
Empty file modified public/robots.txt
100644 → 100755
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/V5RC-OverUnder-H2H-TileColor66_71-2000x2000.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/VIQC-FieldPerimeter-8ft6ft-2000x1517.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/VIQC-FullVolume-8ft6ft-2000x1517.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/VIQC-RapidRelay-8ft6ft-2000x1517.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/VURC-HighStakes-H2H-TileColor66_71-2000x2000.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/VURC-OverUnder-H2H-TileColor66_71-2000x2000.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/instruction-to-brave-browser-1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/instruction-to-brave-browser-2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/logo192.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/logo464.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/logo512-apple.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/logo512-safe.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/logo512.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/static/readme-banner-0.5x.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/App.test.tsx
100644 → 100755
Empty file.
Empty file modified src/Root.scss
100644 → 100755
Empty file.
Empty file modified src/Root.tsx
100644 → 100755
Empty file.
Empty file modified src/app/Layouts.tsx
100644 → 100755
Empty file.
Empty file modified src/app/MarkdownSupport.tsx
100644 → 100755
Empty file.
Empty file modified src/app/MarkdownTest.mdx
100644 → 100755
Empty file.
Empty file modified src/app/Notice.tsx
100644 → 100755
Empty file.
Empty file modified src/app/Theme.tsx
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/MousePositionPresentation.scss
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/_index.scss
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/_index.tsx
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/panel/ControlConfigPanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/panel/MenuPanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/panel/PathTreePanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/classic.blocks/speed-canvas/SpeedCanvasElement.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/DragDropBackdrop.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/MousePositionPresentation.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/_index.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/_index.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/field-canvas/AreaSelectionElement.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/field-canvas/ControlElement.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/field-canvas/FieldCanvasElement.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/field-canvas/RobotElement.tsx
100644 → 100755
Empty file.
Empty file.
Empty file modified src/app/common.blocks/field-canvas/SegmentElement.tsx
100644 → 100755
Empty file.
Empty file.
Empty file modified src/app/common.blocks/modal/AboutModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/AboutModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/AssetManagerModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/AssetManagerModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/ConfirmationModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/ConfirmationModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/CoordinateSystemModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/CoordinateSystemModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/Modal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/Modal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/PreferencesModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/PreferencesModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/RequireLocalFieldImageModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/RequireLocalFieldImageModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/WelcomeForBrave.mdx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/WelcomeForOthers.mdx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/WelcomeModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/modal/WelcomeModal.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/ControlConfigPanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/ControlConfigPanel.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/GeneralConfigPanel.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/MenuPanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/MenuPanel.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/Panel.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/Panel.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/PathTreePanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/panel/PathTreePanel.tsx
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/speed-canvas/SpeedCanvasElement.scss
100644 → 100755
Empty file.
Empty file modified src/app/common.blocks/speed-canvas/SpeedCanvasElement.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/CanvasTooltip.scss
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/CanvasTooltip.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormButton.scss
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormButton.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormCheckbox.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormEnumSelect.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormInputField.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/FormItemSelect.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/OpenModalButton.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/PanelBox.tsx
100644 → 100755
Empty file.
Empty file modified src/app/component.blocks/RangeSlider.tsx
100644 → 100755
Empty file.
Empty file modified src/app/exclusive.blocks/_index.scss
100644 → 100755
Empty file.
Empty file modified src/app/exclusive.blocks/_index.tsx
100644 → 100755
Empty file.
Empty file modified src/app/exclusive.blocks/panel/PathTreePanel.scss
100644 → 100755
Empty file.
Empty file modified src/app/exclusive.blocks/speed-canvas/SpeedCanvasElement.scss
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/_index.scss
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/_index.tsx
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/modal/AssetManagerModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/modal/CoordinateSystemModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/modal/WelcomeModal.scss
100644 → 100755
Empty file.
Empty file modified src/app/mobile.blocks/panel/PathTreePanel.scss
100644 → 100755
Empty file.
Empty file modified src/core/Asset.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Asset.ts
100644 → 100755
Empty file.
Empty file modified src/core/Calculation.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Calculation.ts
100644 → 100755
Empty file.
Empty file modified src/core/Canvas.ts
100644 → 100755
Empty file.
Empty file modified src/core/Clipboard.ts
100644 → 100755
Empty file.
Empty file modified src/core/Command.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Command.ts
100644 → 100755
Empty file.
Empty file modified src/core/Coordinate.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Coordinate.ts
100644 → 100755
Empty file.
Empty file modified src/core/CoordinateSystem.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/CoordinateSystem.ts
100644 → 100755
Empty file.
Empty file modified src/core/FieldEditor.ts
100644 → 100755
Empty file.
Empty file modified src/core/FieldImagePrompt.tsx
100644 → 100755
Empty file.
Empty file modified src/core/GoogleAnalytics.ts
100644 → 100755
Empty file.
Empty file modified src/core/Hook.ts
100644 → 100755
Empty file.
Empty file modified src/core/InputOutput.ts
100644 → 100755
Empty file.
Empty file modified src/core/Layout.ts
100644 → 100755
Empty file.
Empty file modified src/core/Logger.ts
100644 → 100755
Empty file.
Empty file modified src/core/LoggerImpl.ts
100644 → 100755
Empty file.
Empty file modified src/core/Magnet.ts
100644 → 100755
Empty file.
Empty file modified src/core/MainApp.ts
100644 → 100755
Empty file.
Empty file modified src/core/Path.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Path.ts
100644 → 100755
Empty file.
Empty file modified src/core/Preferences.ts
100644 → 100755
Empty file.
Empty file modified src/core/ServiceWorkerMessages.ts
100644 → 100755
Empty file.
Empty file modified src/core/ServiceWorkerRegistration.ts
100644 → 100755
Empty file.
Empty file modified src/core/SpeedEditor.ts
100644 → 100755
Empty file.
Empty file modified src/core/TouchEventListener.ts
100644 → 100755
Empty file.
Empty file modified src/core/Unit.ts
100644 → 100755
Empty file.
Empty file modified src/core/Util.test.ts
100644 → 100755
Empty file.
Empty file modified src/core/Util.ts
100644 → 100755
Empty file.
Empty file modified src/core/Versioning.tsx
100644 → 100755
Empty file.
Empty file modified src/format/Config.test.ts
100644 → 100755
Empty file.
Empty file modified src/format/Config.tsx
100644 → 100755
Empty file.
Empty file modified src/format/Format.test.ts
100644 → 100755
Empty file.
9 changes: 7 additions & 2 deletions src/format/Format.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LemLibFormatV1_0 } from "./LemLibFormatV1_0";
import { isExperimentalFeaturesEnabled } from "@core/Preferences";
import { RigidCodeGenFormatV0_1 } from "./RigidCodeGenFormatV0_1";
import { MoveToPointCodeGenFormatV0_1 } from "./MoveToPointCodeGenFormatV0_1";

import { xVecLibBoomerangFormatV0_1 } from "./xVecLibBoomerangFormatV0_1";
export interface Format {
isInit: boolean;
uid: string;
Expand Down Expand Up @@ -121,7 +121,12 @@ export function getAllDeprecatedFormats(): Format[] {

export function getAllExperimentalFormats(): Format[] {
if (!isExperimentalFeaturesEnabled()) return [];
return [new LemLibFormatV1_0(), new RigidCodeGenFormatV0_1(), new MoveToPointCodeGenFormatV0_1()];
return [
new LemLibFormatV1_0(),
new RigidCodeGenFormatV0_1(),
new MoveToPointCodeGenFormatV0_1(),
new xVecLibBoomerangFormatV0_1()
];
}

export function getAllFormats(): Format[] {
Expand Down
Empty file modified src/format/LemLibFormatV0_4/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibFormatV0_4/index.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibFormatV1_0/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibFormatV1_0/Serialization.ts
100644 → 100755
Empty file.
Empty file modified src/format/LemLibFormatV1_0/index.test.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibFormatV1_0/index.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibOdomGeneratorFormatV0_4/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibOdomGeneratorFormatV0_4/PathConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/LemLibOdomGeneratorFormatV0_4/index.tsx
100644 → 100755
Empty file.
Empty file modified src/format/MoveToPointCodeGenFormatV0_1/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/MoveToPointCodeGenFormatV0_1/PathConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/MoveToPointCodeGenFormatV0_1/index.tsx
100644 → 100755
Empty file.
Empty file modified src/format/PathDotJerryioFormatV0_1/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/PathDotJerryioFormatV0_1/PathConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/PathDotJerryioFormatV0_1/index.tsx
100644 → 100755
Empty file.
Empty file modified src/format/RigidCodeGenFormatV0_1/GeneralConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/RigidCodeGenFormatV0_1/PathConfig.tsx
100644 → 100755
Empty file.
Empty file modified src/format/RigidCodeGenFormatV0_1/index.tsx
100644 → 100755
Empty file.
179 changes: 179 additions & 0 deletions src/format/xVecLibBoomerangFormatV0_1/GeneralConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
import { makeAutoObservable, action } from "mobx";
import { Typography, Button } from "@mui/material";
import { enqueueSuccessSnackbar, enqueueErrorSnackbar } from "@src/app/Notice";
import { FieldImageSignatureAndOrigin, FieldImageOriginType, getDefaultBuiltInFieldImage } from "@core/Asset";
import { UpdateProperties } from "@core/Command";
import { useCustomHotkeys, getEnableOnNonTextInputFieldsHotkeysOptions } from "@core/Hook";
import { getAppStores } from "@core/MainApp";
import { Logger } from "@core/Logger";
import { UnitOfLength } from "@core/Unit";
import { IS_MAC_OS, getMacHotKeyString, ValidateNumber } from "@core/Util";
import { Int, CodePointBuffer } from "@src/token/Tokens";
import { Expose, Type, Exclude } from "class-transformer";
import { IsPositive, IsBoolean, ValidateNested, IsObject, IsString, MinLength, IsIn } from "class-validator";
import { observer } from "mobx-react-lite";
import { GeneralConfig, initGeneralConfig } from "../Config";
import { Format } from "../Format";
import { PanelBox } from "@src/app/component.blocks/PanelBox";
import { FormInputField } from "@src/app/component.blocks/FormInputField";
import { getNamedCoordinateSystems } from "@src/core/CoordinateSystem";
import { FormCheckbox } from "@src/app/component.blocks/FormCheckbox";
interface FormatWithExportCode extends Format {
exportCode(): string;
}

const logger = Logger("xVecLib Boomerang v1.0.0 (inch)");

const GeneralConfigPanel = observer((props: { config: GeneralConfigImpl }) => {
const { config } = props;

const { app, confirmation, ui } = getAppStores();

const isUsingEditor = !confirmation.isOpen && !ui.isOpeningModal;

const onCopyCode = action(() => {
try {
const code = config.format.exportCode();

navigator.clipboard.writeText(code);

enqueueSuccessSnackbar(logger, "Copied");
} catch (e) {
enqueueErrorSnackbar(logger, e);
}
});

useCustomHotkeys("Shift+Mod+C", onCopyCode, getEnableOnNonTextInputFieldsHotkeysOptions(isUsingEditor));

const hotkey = IS_MAC_OS ? getMacHotKeyString("Shift+Mod+C") : "Shift+Ctrl+C";

return (
<>
<Typography sx={{ marginTop: "16px" }}>Export Settings</Typography>
<PanelBox className="Panel-FlexBox">
<FormInputField
label="Chassis Name"
getValue={() => config.chassisName}
setValue={(value: string) => {
app.history.execute(`Change chassis variable name`, new UpdateProperties(config, { chassisName: value }));
}}
isValidIntermediate={() => true}
isValidValue={(candidate: string) => candidate !== ""}
sx={{ marginTop: "16px" }}
/>
<FormInputField
label="Movement Timeout"
getValue={() => config.movementTimeout.toString()}
setValue={(value: string) => {
const parsedValue = parseInt(Int.parse(new CodePointBuffer(value))!.value);
app.history.execute(
`Change default movement timeout to ${parsedValue}`,
new UpdateProperties(config, { movementTimeout: parsedValue })
);
}}
isValidIntermediate={() => true}
isValidValue={(candidate: string) => Int.parse(new CodePointBuffer(candidate)) !== null}
sx={{ marginTop: "16px" }}
numeric
/>
</PanelBox>

<PanelBox marginTop="16px">
<Button variant="contained" title={`Copy Generated Code (${hotkey})`} onClick={onCopyCode}>
Copy Code
</Button>
<a href="https://xvec.codeberg.page/Path%20Generation"><h3>Documentation</h3></a>

</PanelBox>
<Typography sx={{ marginTop: "16px" }}>Lead Settings</Typography>
<PanelBox className="Panel-FlexBox">
<FormInputField
label="Iterations to find lead"
getValue={() => config.maxIterations.toString()}
setValue={(value: string) => {
const parsedValue = parseInt(Int.parse(new CodePointBuffer(value))!.value);
app.history.execute(
`Change max iterations for lead to ${parsedValue}`,
new UpdateProperties(config, { maxIterations: parsedValue })
);
}}
isValidIntermediate={() => true}
isValidValue={(candidate: string) => Int.parse(new CodePointBuffer(candidate)) !== null}
sx={{ marginTop: "16px" }}
numeric
/>
<FormCheckbox
label="Use broken lead"
checked={config.badLead}
onCheckedChange={value => {
app.history.execute(`Using real(bad) lead's is ${value}`, new UpdateProperties(config, { badLead: value }));
}}
/>
</PanelBox>
</>
);
});
export class GeneralConfigImpl implements GeneralConfig {
@IsPositive()
@Expose()
robotWidth: number = 12;
@IsPositive()
@Expose()
robotHeight: number = 12;
@IsBoolean()
@Expose()
robotIsHolonomic: boolean = false;
@IsBoolean()
@Expose()
showRobot: boolean = false;
@ValidateNumber(num => num > 0 && num <= 1000) // Don't use IsEnum
@Expose()
uol: UnitOfLength = UnitOfLength.Inch;
@IsPositive()
@Expose()
pointDensity: number = 2; // inches
@IsPositive()
@Expose()
controlMagnetDistance: number = 5 / 2.54;
@Type(() => FieldImageSignatureAndOrigin)
@ValidateNested()
@IsObject()
@Expose()
fieldImage: FieldImageSignatureAndOrigin<FieldImageOriginType> =
getDefaultBuiltInFieldImage().getSignatureAndOrigin();
@IsString()
@MinLength(1)
@Expose()
chassisName: string = "chassis";
@ValidateNumber(num => num >= 0)
@Expose()
movementTimeout: number = 5000;
@Expose()
maxIterations: number = 200;
@IsBoolean()
@Expose()
badLead: boolean = false;
@IsBoolean()
@Expose()
relativeCoords: boolean = true;
@IsIn(getNamedCoordinateSystems().map(s => s.name))
@Expose()
coordinateSystem: string = "VEX Gaming Positioning System";
@Exclude()
private format_: FormatWithExportCode;

constructor(format: FormatWithExportCode) {
this.format_ = format;
makeAutoObservable(this);

initGeneralConfig(this);
}

get format() {
return this.format_;
}

getAdditionalConfigUI() {
return <GeneralConfigPanel config={this} />;
}
}
71 changes: 71 additions & 0 deletions src/format/xVecLibBoomerangFormatV0_1/PathConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { makeAutoObservable } from "mobx";
import { Typography } from "@mui/material";
import { BentRateApplicationDirection, Path } from "@core/Path";
import { EditableNumberRange } from "@core/Util";
import { Exclude, Expose } from "class-transformer";
import { IsNumber } from "class-validator";
import { PathConfig } from "../Config";
import { Format } from "../Format";
import { LayoutContext, LayoutType, PanelBuilderProps, PanelInstanceProps } from "@core/Layout";
import { getAppStores } from "@core/MainApp";
import { observer } from "mobx-react-lite";
import React from "react";
import LinearScaleIcon from "@mui/icons-material/LinearScale";

// observable class
export class PathConfigImpl implements PathConfig {
@Exclude()
speedLimit: EditableNumberRange = {
minLimit: { value: 0, label: "0" },
maxLimit: { value: 127, label: "127" },
step: 1,
from: 0,
to: 1
};
@Exclude()
bentRateApplicableRange: EditableNumberRange = {
minLimit: { value: 0, label: "0" },
maxLimit: { value: 1, label: "1" },
step: 0.01,
from: 0,
to: 1
};
@Exclude()
bentRateApplicationDirection = BentRateApplicationDirection.LowToHigh;
@IsNumber()
@Expose()
speed: number = 30;
@Exclude()
readonly format: Format;

@Exclude()
public path!: Path;

constructor(format: Format) {
this.format = format;
makeAutoObservable(this);
}
}

const PathConfigPanelBody = observer((props: {}) => {
const { app } = getAppStores();

const pc = app.selectedPath?.pc as PathConfigImpl | undefined;

const isClassic = React.useContext(LayoutContext) === LayoutType.Classic;

if (pc === undefined) {
return isClassic ? undefined : <Typography>(No selected path)</Typography>;
}

return;
});

export const PathConfigPanel = (props: PanelBuilderProps): PanelInstanceProps => {
return {
id: "PathConfigAccordion",
header: "Path",
children: <PathConfigPanelBody />,
icon: <LinearScaleIcon fontSize="large" />
};
};
40 changes: 40 additions & 0 deletions src/format/xVecLibBoomerangFormatV0_1/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { xVecLibBoomerangFormatV0_1 } from ".";
import { MainApp, getAppStores } from "@core/MainApp";
import { Control, EndControl, Segment } from "@core/Path";
import { GeneralConfigImpl } from "./GeneralConfig";
import { SmartBuffer } from "smart-buffer";
import { LemLibV1_0 } from "../LemLibFormatV1_0/Serialization";
test("dummy", () => {
const { app } = getAppStores(); // suppress constructor error
});
test("read write path file", () => {
const format = new xVecLibBoomerangFormatV0_1();
const path = format.createPath();

const buffer1 = SmartBuffer.fromSize(1024); // auto resize
path.segments.push(new Segment(new EndControl(1, 1, 0), new EndControl(60, 60, 90)));
path.segments.push(new Segment(path.segments[path.segments.length - 1].last, new EndControl(63, 60, 180)));
path.segments.push(new Segment(path.segments[path.segments.length - 1].last, new EndControl(64, 60, 270)));

LemLibV1_0.writePath(buffer1, path);

const result = LemLibV1_0.readPath(buffer1);

expect(result.name).toBe(path.name);

const points = path.cachedResult.points;

expect(result.waypoints.length).toBe(points.length);

for (let i = 0; i < points.length; i++) {
const point1 = points[i];
const point2 = result.waypoints[i];

expect(point2.x).toBeCloseTo(point1.x, 0.1);
expect(point2.y).toBeCloseTo(point1.y, 0.1);
expect(point2.heading ?? 0).toBeCloseTo(point1.heading ?? 0);
}

// let code = format.exportCode();
// console.log(code);
});
Loading