]> OCCT Git - occt-copy.git/commitdiff
0030484: Visualization - 2d persistent: order of detection doesn't coincide with... CR30484
authornds <nds@opencascade.com>
Thu, 7 Feb 2019 12:31:50 +0000 (15:31 +0300)
committernds <nds@opencascade.com>
Thu, 7 Feb 2019 12:31:50 +0000 (15:31 +0300)
src/SelectMgr/SelectMgr_ViewerSelector.cxx
tests/bugs/vis/bug30484 [new file with mode: 0644]

index 0fb6c8666e40539cc556ec48d2858f92d3c9354b..c693773d84f051ffc5c989a350d7e0f8f0365b37 100644 (file)
@@ -282,6 +282,9 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
   aCriterion.Priority  = anOwner->Priority();
   aCriterion.Depth     = aPickResult.Depth();
   aCriterion.MinDist   = aPickResult.DistToGeomCenter();
+  if (!aSelectable.IsNull() && !aSelectable->TransformPersistence().IsNull() &&
+     aSelectable->TransformPersistence()->Mode() == Graphic3d_TMF_2d)
+    aCriterion.MinDist = 0; // having 2D persistent, 3D geometry point is not required
   aCriterion.ToPreferClosest = preferclosest;
 
   if (SelectMgr_SortCriterion* aPrevCriterion = mystored.ChangeSeek (anOwner))
diff --git a/tests/bugs/vis/bug30484 b/tests/bugs/vis/bug30484
new file mode 100644 (file)
index 0000000..2081254
--- /dev/null
@@ -0,0 +1,29 @@
+puts "============="
+puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation
+puts "============="
+
+pload MODELING VISUALIZATION
+vclear
+
+vinit
+vselprops dynHighlight -dispMode 1 -color WHITE
+
+box box_1 75 -250 0 200 200 200
+box box_2 175 -300 0 200 200 200
+
+vdisplay box_1 -2d topLeft -top -dispmode 1
+vsetmaterial box_1  PLASTIC
+vsetcolor    box_1 DEEPPINK2
+
+vdisplay box_2 -2d topLeft -top -dispmode 1
+vsetmaterial box_2 PLASTIC
+vsetcolor    box_2 PALEGREEN2
+
+vmoveto 205 170
+
+if { [vreadpixel 205 170 rgb name] != "WHITE" } { puts "Error: common area should be highlighted" }
+if { [vreadpixel 150 170 rgb name] == "WHITE" } { puts "Error: box_1 should NOT be highlighted" }
+if { [vreadpixel 330 170 rgb name] != "WHITE" } { puts "Error: box_2 should be highlighted" }
+
+vdump $imagedir/${casename}.png
+