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)
|
const u = await getUtils(page)
|
||||||
|
|
||||||
// Constants and locators
|
// 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 bgColor: [number, number, number] = [27, 27, 27]
|
||||||
const middlePixelIsColor = async (color: [number, number, number]) => {
|
const middlePixelIsColor = async (color: [number, number, number]) => {
|
||||||
return u.getGreatestPixDiff({ x: 600, y: 250 }, color)
|
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,
|
y: screenHeight * 0.4,
|
||||||
}
|
}
|
||||||
const backgroundColor: [number, number, number] = [29, 29, 29]
|
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]) => {
|
const locationToHaveColor = async (color: [number, number, number]) => {
|
||||||
return u.getGreatestPixDiff(checkedScreenLocation, color)
|
return u.getGreatestPixDiff(checkedScreenLocation, color)
|
||||||
}
|
}
|
||||||
|
@ -342,92 +342,80 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
id_generator: &mut IdGenerator,
|
id_generator: &mut IdGenerator,
|
||||||
source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
) -> Result<DefaultPlanes, KclError> {
|
) -> 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,
|
PlaneName::Xy,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
||||||
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
Some(Color {
|
||||||
Some(Color {
|
r: 0.7,
|
||||||
r: 0.7,
|
g: 0.28,
|
||||||
g: 0.28,
|
b: 0.28,
|
||||||
b: 0.28,
|
a: 0.4,
|
||||||
a: 0.4,
|
}),
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
PlaneName::Yz,
|
PlaneName::Yz,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
Some(Color {
|
||||||
Some(Color {
|
r: 0.28,
|
||||||
r: 0.28,
|
g: 0.7,
|
||||||
g: 0.7,
|
b: 0.28,
|
||||||
b: 0.28,
|
a: 0.4,
|
||||||
a: 0.4,
|
}),
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
PlaneName::Xz,
|
PlaneName::Xz,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
||||||
Point3d { x: 1.0, y: 0.0, z: 0.0 },
|
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
Some(Color {
|
||||||
Some(Color {
|
r: 0.28,
|
||||||
r: 0.28,
|
g: 0.28,
|
||||||
g: 0.28,
|
b: 0.7,
|
||||||
b: 0.7,
|
a: 0.4,
|
||||||
a: 0.4,
|
}),
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
PlaneName::NegXy,
|
PlaneName::NegXy,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d {
|
||||||
Point3d {
|
x: -1.0,
|
||||||
x: -1.0,
|
y: 0.0,
|
||||||
y: 0.0,
|
z: 0.0,
|
||||||
z: 0.0,
|
},
|
||||||
},
|
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
||||||
Point3d { x: 0.0, y: 1.0, z: 0.0 },
|
None,
|
||||||
None,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
PlaneName::NegYz,
|
PlaneName::NegYz,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d {
|
||||||
Point3d {
|
x: 0.0,
|
||||||
x: 0.0,
|
y: -1.0,
|
||||||
y: -1.0,
|
z: 0.0,
|
||||||
z: 0.0,
|
},
|
||||||
},
|
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
None,
|
||||||
None,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
PlaneName::NegXz,
|
PlaneName::NegXz,
|
||||||
(
|
id_generator.next_uuid(),
|
||||||
id_generator.next_uuid(),
|
Point3d {
|
||||||
Point3d {
|
x: -1.0,
|
||||||
x: -1.0,
|
y: 0.0,
|
||||||
y: 0.0,
|
z: 0.0,
|
||||||
z: 0.0,
|
},
|
||||||
},
|
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
||||||
Point3d { x: 0.0, y: 0.0, z: 1.0 },
|
None,
|
||||||
None,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
]);
|
];
|
||||||
|
|
||||||
let mut planes = HashMap::new();
|
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(
|
planes.insert(
|
||||||
name,
|
name,
|
||||||
self.make_default_plane(plane_id, x_axis, y_axis, color, source_range)
|
self.make_default_plane(plane_id, x_axis, y_axis, color, source_range)
|
||||||
|