• canvas "moveto" .. is it a BUG ?

    From aldo.w.buratti@gmail.com@21:1/5 to All on Fri Aug 27 15:21:40 2021
    I'm working on Windows10, TclTk 8.6.11 (64bit)

    Working with a canvas, and trying to use the "moveto" command, I noticed this strange behavior that I would call it a BUG.

    See the short example below; in practice when I move-to an item (a rectangle) to (x,y), its coords are changed to(x+1,y+1,.....) !

    Is it a BUG or can you give some explanation ?

    canvas .c ; pack .c
    .c create rectangle 0 0 50 50 -tag RECT
    .c coords RECT
    # ---> 0.0 0.0 50.0 50.0 (ok)
    .c move RECT 100 100
    .c coords RECT
    # --> 100.0 100.0 150.0 150.0 (ok)
    ### NOW moving with "moveto" ...
    .c moveto RECT 100 100
    .c coords RECT
    # --> 101.0 101.0 151.0 151.0 (WRONG ! it should be 100 100 150 150)
    .c moveto RECT 0 0
    .c coords RECT
    # --> 1.0 1.0 51.0 51.0 (WRONG ! it should be 0 0 50 50)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Uwe Schmitz@21:1/5 to All on Mon Aug 30 01:44:56 2021
    Please try this:

    canvas .c ; pack .c
    .c create rectangle 0 0 50 50 -outline "" -tag RECT
    .c moveto RECT 100 100
    .c coords RECT
    100.0 100.0 150.0 150.0

    The problem is that the rectangle in your example gets an outline
    per default which counts when calculating the bounding box:

    pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first
    coordinate pair (the upper-left corner of the bounding box) ...

    Hope that helps.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aldo.w.buratti@gmail.com@21:1/5 to All on Sun Sep 5 13:47:25 2021
    Il giorno lunedì 30 agosto 2021 alle 10:44:58 UTC+2 Uwe Schmitz ha scritto:
    Please try this:

    canvas .c ; pack .c
    .c create rectangle 0 0 50 50 -outline "" -tag RECT
    .c moveto RECT 100 100
    .c coords RECT
    100.0 100.0 150.0 150.0

    The problem is that the rectangle in your example gets an outline
    per default which counts when calculating the bounding box:

    pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first
    coordinate pair (the upper-left corner of the bounding box) ...

    Hope that helps.

    Sorry but I don't agree.

    From the canvas widget spec:
    [..] pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag tagOrId is located at position (xPos,yPos). xPos and yPos may be the empty string, in which case the corresponding coordinate
    will be unchanged. All items matching tagOrId remain in the same positions relative to each other. This command returns an empty string.

    With other words, "moveto" has nothing to do with the item's border thickness or the bbox, just with the position of item as returned by the "coords" method.
    As my little code snippet demonstrated, when I "moveto" a RECT to (100,100) the "first coordinate pair of the bottommost item"
    it's not moved to (100,100) but it's moved to (101,101) !

    I think that I should open a BUG.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aldo.w.buratti@gmail.com@21:1/5 to All on Sun Sep 5 14:01:43 2021
    Il giorno domenica 5 settembre 2021 alle 22:47:27 UTC+2 aldo.w....@gmail.com ha scritto:
    Il giorno lunedì 30 agosto 2021 alle 10:44:58 UTC+2 Uwe Schmitz ha scritto:
    Please try this:

    canvas .c ; pack .c
    .c create rectangle 0 0 50 50 -outline "" -tag RECT
    .c moveto RECT 100 100
    .c coords RECT
    100.0 100.0 150.0 150.0

    The problem is that the rectangle in your example gets an outline
    per default which counts when calculating the bounding box:

    pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first
    coordinate pair (the upper-left corner of the bounding box) ...

    Hope that helps.
    Sorry but I don't agree.

    From the canvas widget spec:
    [..] pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag tagOrId is located at position (xPos,yPos). xPos and yPos may be the empty string, in which case the corresponding
    coordinate will be unchanged. All items matching tagOrId remain in the same positions relative to each other. This command returns an empty string.

    With other words, "moveto" has nothing to do with the item's border thickness or the bbox, just with the position of item as returned by the "coords" method.
    As my little code snippet demonstrated, when I "moveto" a RECT to (100,100) the "first coordinate pair of the bottommost item"
    it's not moved to (100,100) but it's moved to (101,101) !

    I think that I should open a BUG.

    Ticket opened
    "canvas moveto wrong placement" https://core.tcl-lang.org/tk/tktview/1215ed745b5c209cce02fc3b22d1a69dcc0cd4be

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Uwe Schmitz@21:1/5 to All on Mon Sep 6 02:22:37 2021
    From the canvas widget spec:
    [..] pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag tagOrId is located at position (xPos,yPos). xPos and yPos may be the empty string, in which case the corresponding
    coordinate will be unchanged. All items matching tagOrId remain in the same positions relative to each other. This command returns an empty string.

    I don' know where you get this specification, which doesn't mention the bounding box.
    IMO the "official" documentation for canvas moveto (V8.6) is here: https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M60

    and this mentions the bounding box as the source for the moveto.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nemethi@21:1/5 to All on Mon Sep 6 15:04:42 2021
    Am 06.09.21 um 11:22 schrieb Uwe Schmitz:
    From the canvas widget spec:
    [..] pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag tagOrId is located at position (xPos,yPos). xPos and yPos may be the empty string, in which case the corresponding
    coordinate will be unchanged. All items matching tagOrId remain in the same positions relative to each other. This command returns an empty string.

    I don' know where you get this specification, which doesn't mention the bounding box.
    IMO the "official" documentation for canvas moveto (V8.6) is here: https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M60

    and this mentions the bounding box as the source for the moveto.


    The clarification "(the upper-left corner of the bounding box)" was
    added to the description of the moveto command in the canvas man page in
    Tk 8.6.11, thus fixing a documentation bug reported by Schelte Bron back
    in 2014. See

    https://core.tcl-lang.org/tk/tktview?name=279b027fd7

    --
    Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aldo.w.buratti@gmail.com@21:1/5 to All on Tue Sep 7 08:55:58 2021
    Il giorno lunedì 6 settembre 2021 alle 15:04:45 UTC+2 nemethi ha scritto:
    Am 06.09.21 um 11:22 schrieb Uwe Schmitz:
    From the canvas widget spec:
    [..] pathName moveto tagOrId xPos yPos
    Move the items given by tagOrId in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag tagOrId is located at position (xPos,yPos). xPos and yPos may be the empty string, in which case the corresponding
    coordinate will be unchanged. All items matching tagOrId remain in the same positions relative to each other. This command returns an empty string.

    I don' know where you get this specification, which doesn't mention the bounding box.
    IMO the "official" documentation for canvas moveto (V8.6) is here: https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M60

    and this mentions the bounding box as the source for the moveto.

    The clarification "(the upper-left corner of the bounding box)" was
    added to the description of the moveto command in the canvas man page in
    Tk 8.6.11, thus fixing a documentation bug reported by Schelte Bron back
    in 2014. See

    https://core.tcl-lang.org/tk/tktview?name=279b027fd7

    --
    Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de
    Many thanks Csaba,
    I wasn't able to find that old BUG among the Tk tickets.
    Let me say that I'm not happy with that Fix (the spec was fixed instead of the implementation ..),.
    Anyway, if these are the new specifications, I will be very careful in using the "moveto" command.
    Thanks again
    Aldo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)