Fix default planes to be created in deterministic order (#4664)
* Fix default planes to be created in deterministic order * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) * Trigger CI --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ -550,7 +550,7 @@ sketch001 = startSketchAt([-0, -0])
|
||||
const u = await getUtils(page)
|
||||
|
||||
// Constants and locators
|
||||
const planeColor: [number, number, number] = [170, 220, 170]
|
||||
const planeColor: [number, number, number] = [161, 220, 155]
|
||||
const bgColor: [number, number, number] = [27, 27, 27]
|
||||
const middlePixelIsColor = async (color: [number, number, number]) => {
|
||||
return u.getGreatestPixDiff({ x: 600, y: 250 }, color)
|
||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 51 KiB |
@ -23,7 +23,7 @@ test.describe('Test toggling perspective', () => {
|
||||
y: screenHeight * 0.4,
|
||||
}
|
||||
const backgroundColor: [number, number, number] = [29, 29, 29]
|
||||
const xzPlaneColor: [number, number, number] = [50, 50, 99]
|
||||
const xzPlaneColor: [number, number, number] = [82, 55, 96]
|
||||
const locationToHaveColor = async (color: [number, number, number]) => {
|
||||
return u.getGreatestPixDiff(checkedScreenLocation, color)
|
||||
}
|
||||
|
@ -342,10 +342,9 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
id_generator: &mut IdGenerator,
|
||||
source_range: SourceRange,
|
||||
) -> Result<DefaultPlanes, KclError> {
|
||||
let plane_settings: HashMap<PlaneName, (Uuid, Point3d, Point3d, Option<Color>)> = HashMap::from([
|
||||
let plane_settings: Vec<(PlaneName, Uuid, Point3d, Point3d, Option<Color>)> = vec![
|
||||
(
|
||||
PlaneName::Xy,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||
@ -356,10 +355,8 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
a: 0.4,
|
||||
}),
|
||||
),
|
||||
),
|
||||
(
|
||||
PlaneName::Yz,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||
@ -370,10 +367,8 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
a: 0.4,
|
||||
}),
|
||||
),
|
||||
),
|
||||
(
|
||||
PlaneName::Xz,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||
@ -384,10 +379,8 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
a: 0.4,
|
||||
}),
|
||||
),
|
||||
),
|
||||
(
|
||||
PlaneName::NegXy,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d {
|
||||
x: -1.0,
|
||||
@ -397,10 +390,8 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||
None,
|
||||
),
|
||||
),
|
||||
(
|
||||
PlaneName::NegYz,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d {
|
||||
x: 0.0,
|
||||
@ -410,10 +401,8 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||
None,
|
||||
),
|
||||
),
|
||||
(
|
||||
PlaneName::NegXz,
|
||||
(
|
||||
id_generator.next_uuid(),
|
||||
Point3d {
|
||||
x: -1.0,
|
||||
@ -423,11 +412,10 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||
None,
|
||||
),
|
||||
),
|
||||
]);
|
||||
];
|
||||
|
||||
let mut planes = HashMap::new();
|
||||
for (name, (plane_id, x_axis, y_axis, color)) in plane_settings {
|
||||
for (name, plane_id, x_axis, y_axis, color) in plane_settings {
|
||||
planes.insert(
|
||||
name,
|
||||
self.make_default_plane(plane_id, x_axis, y_axis, color, source_range)
|
||||
|