octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49446] Graphics objects (esp. legends) should


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #49446] Graphics objects (esp. legends) should be manipulated/dragged with the mouse
Date: Wed, 26 Oct 2016 15:46:00 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0

Follow-up Comment #3, bug #49446 (project octave):

Here is an ugly workaround for moving legends with mouse:


function downfcn (h)
  pos = get (h, "position");
  fpt = get (gcbf, "currentpoint");
  setappdata (gcbf, "legenddragged", {h, pos(1:2)./fpt});
endfunction

function movefcn (h)
  data = getappdata (h, "legenddragged");
  if (isempty (data))
    return
  endif
  pos = get (data{1}, "position");
  pos(1:2) = get (gcbf, "currentpoint").*data{2};
  set (data{1}, "position",  pos)
endfunction

function upfcn (h);
  setappdata (h, "legenddragged", []);
endfunction

plot (1:10)
hl = legend ("toto");
set (hl, "buttondownfcn", @downfcn)
set (gcf, "windowbuttonmotionfcn", @movefcn)
set (gcf, "windowbuttonupfcn", @upfcn)


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49446>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]