BTW, I know that this is just an example, but if you are going to draw primitives in a canvas using elements as reference points, then I would suggest you to use the same coordinate system as the IupGLCanvasBox elements. For instance, using:
gl.Ortho(0, width, 0, height, -1, 1) I attached a modified version of the example with this approach. Just to illustrate. Best, Scuri 2017-06-30 0:20 GMT-03:00 Antonio Scuri <[email protected]>: > Hi, > > You set the frame position to be 10,10. That's where the 10 pixel offset > came from. Experiment to set it to 50,50 and you will see that difference > to increase even more. > > So what's missing is to offset the desired point by the frame position. > For instance: > > local frm_x,frm_y = gframe.position:match("(%d+),(%d+)") > local frm_w,frm_h = gframe.rastersize:match("(%d+)x(%d+)") > local cnv_w,cnv_h = cnv.rastersize:match("(%d+)x(%d+)") > > -- calculate the bottom middle point > local x = frm_x + frm_w/2 > local y = frm_y + frm_h > > local cnvx = cnv_w/2 > local cnvy = cnv_h/2 > > Best, > Scuri > > 2017-06-29 19:31 GMT-03:00 Milind Gupta <[email protected]>: > >> So the main thing is I am trying to use the frame box as a box in a flow >> almost like a flowchart. So I want to connect lines from a frame box to >> some other point. >> >> On Thu, Jun 29, 2017 at 3:29 PM, Milind Gupta <[email protected]> >> wrote: >> >>> I have attached a sample code. This has a frame with just a label and 2 >>> lines that are drawn from the center to the the bottom line. The red one >>> gets the bottom from rastersize while the blue one adds an offset of 10. >>> >>> On Thu, Jun 29, 2017 at 1:26 PM, Antonio Scuri <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> This is probably related to the space occupied by the TITLE area and >>>> in which callback you are using to draw. Can't tell you what's the best >>>> solution with just that information. >>>> >>>> To draw elements aligned with IUP elements inside a IupGLCanvasBox, I >>>> suggest you to use an IupGLSubCanvas element. You will be able to draw from >>>> 0 to rastersize in its GL_ACTION callback. Use the layout positioning to >>>> align the element inside the glframe. >>>> >>>> Best, >>>> Scuri >>>> >>>> >>>> 2017-06-29 17:08 GMT-03:00 Milind Gupta <[email protected]>: >>>> >>>>> Hi, >>>>> I am trying to draw a line from the mid point of the base of a >>>>> glframe. When I get the rastersize of the frame and use that to calculate >>>>> the midpoint of the base the point comes about 10px below the frame line. >>>>> How can I remove this margin so that rastersize gives me the dimension to >>>>> the frame line. In the x direction there does not seem to be any margin. >>>>> Or is there a way to accurately find out the margin below the >>>>> frame line and then offset my line coordinate by that margin and then >>>>> touch >>>>> the frame line? >>>>> >>>>> Thanks, >>>>> Milind >>>>> >>>>> >>>>> ------------------------------------------------------------ >>>>> ------------------ >>>>> Check out the vibrant tech community on one of the world's most >>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>>>> _______________________________________________ >>>>> Iup-users mailing list >>>>> [email protected] >>>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>>> >>>>> >>>> >>>> ------------------------------------------------------------ >>>> ------------------ >>>> Check out the vibrant tech community on one of the world's most >>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>>> _______________________________________________ >>>> Iup-users mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>> >>>> >>> >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Iup-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/iup-users >> >> >
glcanvasbox2.lua
Description: Binary data
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Iup-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/iup-users
