Re: [Pipmak-Users] Internode comunication
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2006-12-09 15:47:19
|
fpistonesi wrote: > I' have to make a slide control, to do so I have to move a panel Are you sure you want to move a panel, not a patch? Panels are not really made for this. (Though perhaps that could be changed if you can explain why using a panel for this is useful.) > using moveby() method with x or y value of mouseminusclickloc() but how can I limit the range? I don't think moveby() is the right tool for this. The purpose of moveby() is to adjust both the relative and the absolute part of the panel's position in such a way that the panel moves sensibly when the window is resized - if you put it in the center of the window, then resize the window, it will stay centered; if you put it 10 pixels from the right edge, it will stay at 10 pixels from the edge, etc. Assuming that the slider track is on a slide, the proper solution is to keep the absolute part fixed (to the negative of the center of the panel, or whichever point is "attached" to the track) and only modify the relative part. That would work about as follows (it's a mess because, as I said, you're using panels in ways that they weren't intended for): While dragging, add the difference from the click location to the center (or the "fixed point") of the panel to the mouse location. Convert this point from the panel's coordinate system to screen-relative coordinates using the panel's current location and the pipmak.screensize() function. Then clamp that value to the allowed range, and set the relative part of the panel position to it. (I hope you can work out the math on your own, I'd have to spend more time on it as well.) Oh wait, I just found that there's no public method that returns the position of a panel - that's a deficiency that I'll have to fix for 0.2.6. Meanwhile, you can use the <panel>.relx, <panel>.rely, <panel>.absx, <panel>.absy instance variables, but that's not officially supported and might cease to work in a future version. > I think I have to use the mouseloc() coords of the background node but I cannot understand how to pass it to the overlayed panel. To pass things between nodes, you generally use "messages { ... }" and the "message()" method of a node. As an example, have a look at the inventory in the demo project (node 50) and how it's used from node 16. > Another doubt:if on node A MyNode = pipmak.thisnode(),on node B MyNode is still node A? Yes. Each node is represented by a distinct Lua object that is not modified by Pipmak once it's created (I think) (except to invalidate it when the node is left), and Pipmak doesn't assign any new values to global variables you define either. > There's a method that returns the coordinates(x,y) of a node? I can't think of any meaningful definition of the coordinates of a panorama or a slide, but for panels you're right that such a method should exist. As I said above, it currently doesn't, but I just fixed this in Subversion. Thanks for spotting this. If you don't want to wait for the release, you can apply the fix yourself to resources/defaults.lua in the "Pipmak Resources" archive: <http://svn.sourceforge.net/viewvc/pipmak/trunk/pipmak/resources/resources/defaults.lua?r1=119&r2=133> Hope this helps Christian |