diff libinterp/dldfcn/__init_fltk__.cc @ 19027:0ee9daa71273

Fix axes property "currentpoint" for FLTK, extend documentation * plot.txi: Modify documentation for axes property currentpoint * __init_fltk__.cc: Add implementation of currentpoint for 3D plots and fix arrangement of x and y coordinates. * __fltk_ginput__.m: Fix x and y index of currentpoint to reflect bugfix in __init_fltk__.cc
author Andreas Weber <andy.weber.aw@gmail.com>
date Mon, 18 Aug 2014 21:25:39 +0200
parents 9609f345823e
children c419e5487d0d
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc	Mon Aug 18 09:09:18 2014 -0700
+++ b/libinterp/dldfcn/__init_fltk__.cc	Mon Aug 18 21:25:39 2014 +0200
@@ -1148,19 +1148,25 @@
 
   void set_axes_currentpoint (graphics_object ax, int px, int py)
   {
-    if (ax.valid_object ())
+    if (ax.valid_object () && ax.isa ("axes"))
       {
         axes::properties& ap =
           dynamic_cast<axes::properties&> (ax.get_properties ());
 
-        double xx, yy;
-        pixel2pos (ax, px, py, xx, yy);
+        Matrix x_zlim = ap.get_transform_zlim ();
+        Matrix pos (2, 3, 0.0);
 
-        Matrix pos (2,3,0);
-        pos(0,0) = xx;
-        pos(1,0) = yy;
-        pos(0,1) = xx;
-        pos(1,1) = yy;
+        // front point (nearest to the viewer)
+        ColumnVector tmp = ap.get_transform ().untransform (px, py, x_zlim(0));
+        pos(0,0) = tmp(0);
+        pos(0,1) = tmp(1);
+        pos(0,2) = tmp(2);
+
+        // back point (furthest from the viewer)
+        tmp = ap.get_transform ().untransform (px, py, x_zlim(1));
+        pos(1,0) = tmp(0);
+        pos(1,1) = tmp(1);
+        pos(1,2) = tmp(2);
 
         ap.set_currentpoint (pos);
         fp.set_currentaxes (ap.get___myhandle__ ().value ());