forked from 1b-agent/opencadstudio-upstream
Cargo: codec aad7053, kernel 1a52eaf, graph 263de59; honour viewport clipping
Brings codec PRs #84 (cross-version visual styles, table styles, subentity managers), #88 (viewport clipping flag, DXF boundary handle), #89 (DXF viewport snap/twist in degrees) and #92 (field format codes, event updates). With #88 a viewport keeps a stored boundary whether or not clipping is on, so a linked boundary alone no longer means "clipped": rendering, paper picking, VPCLIP and the Clipped property check the clipping flag too, and VPCLIP / MVIEW Object and Polygon set it. Before, OCS never set the flag, so its clipped viewports opened rectangular elsewhere. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2dfa9f3f2a
commit
81bb8d48cf
12 files changed
+32
-19
No files matched your search
+2
-1
@@ -189,7 +189,7 @@ impl Scene {
|
||||
if (paper.x - vp.center.x).abs() > hw || (paper.y - vp.center.y).abs() > hh {
|
||||
return false;
|
||||
}
|
||||
if vp.clip_boundary_handle.is_null() {
|
||||
if !crate::entities::viewport::is_clipped(vp) {
|
||||
return true;
|
||||
}
|
||||
let Some(boundary) = self.document.get_entity(vp.clip_boundary_handle)
|
||||
@@ -321,6 +321,7 @@ mod clip_tests {
|
||||
viewport.width = 20.0;
|
||||
viewport.height = 20.0;
|
||||
viewport.clip_boundary_handle = clip;
|
||||
viewport.status.non_rectangular_clipping = true;
|
||||
let viewport = scene.add_entity(EntityType::Viewport(viewport));
|
||||
for (x, y, inside) in [
|
||||
(2.0, 2.0, true), (8.0, 2.0, true), (8.0, 8.0, false),
|
||||
|
||||
@@ -507,7 +507,7 @@ impl Scene {
|
||||
[xmin as f64, ymin as f64], [xmax as f64, ymin as f64],
|
||||
[xmax as f64, ymax as f64], [xmin as f64, ymax as f64],
|
||||
]];
|
||||
if !self.images.is_empty() && !viewport.clip_boundary_handle.is_null() {
|
||||
if !self.images.is_empty() && crate::entities::viewport::is_clipped(viewport) {
|
||||
let boundary = self.clip_boundary_polygon(
|
||||
viewport.clip_boundary_handle, viewport.center.z as f32);
|
||||
if boundary.len() >= 3 {
|
||||
@@ -663,7 +663,7 @@ impl Scene {
|
||||
if hw.abs() < 1e-6 || hh.abs() < 1e-6 {
|
||||
return vec![];
|
||||
}
|
||||
let poly = if vp.clip_boundary_handle.is_null() {
|
||||
let poly = if !crate::entities::viewport::is_clipped(vp) {
|
||||
// Rectangular viewport → its own four corners (paper coords). These
|
||||
// map to full-rect NDC [-1, 1], a no-op mask over a render target
|
||||
// that already clips to the rectangle, but it keeps rect and
|
||||
|
||||
Reference in new issue
Block a user