Ticket UUID: | 1215ed745b5c209cce02fc3b22d1a69dcc0cd4be | |||
Title: | canvas moveto wrong placement | |||
Type: | Bug | Version: | 8.6.11 | |
Submitter: | anonymous | Created on: | 2021-09-05 20:59:58 | |
Subsystem: | 04. Canvas Basics | Assigned To: | fvogel | |
Priority: | 5 Medium | Severity: | Important | |
Status: | Closed | Last Modified: | 2022-02-26 21:16:09 | |
Resolution: | Invalid | Closed By: | fvogel | |
Closed on: | 2022-02-26 21:16:09 | |||
Description: |
Working with a canvas, and trying to use the "moveto" command, I noticed this strange behavior that I would call it a BUG. I discussed about this strange behaviour on comp.lang.tcl, but the explanations were about the outline thickness and the item's bbox,that in my opinion, have nothing to do with the semantic of the "moveto" command. [from the canvas manual's page] 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). .... See the short example below; in practice when I move-to an item (a simple rectangle) to (x,y), its coords are changed to(x+1,y+1,.....) ! 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) | |||
User Comments: |
fvogel added on 2021-09-06 19:01:24:
Indeed. % pack req Tk 8.7a6 % canvas .c ; pack .c % .c create rectangle 0 0 50 50 -tag RECT 1 % .c coords RECT 0.0 0.0 50.0 50.0 % .c bbox RECT -1 -1 51 51 % .c moveto RECT 100 100 % .c coords RECT 101.0 101.0 151.0 151.0 % .c bbox RECT 100 100 152 152 % nemethi (claiming to be Csaba Nemethi) added on 2021-09-06 14:15:36: That manual page is not for Tk 8.6.11. For this Tk version, the relevant snippet from the man page reads: 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) of the first item (the lowest in the display list) with tag tagOrId is located at position (xPos,yPos). ... 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 and 8.7a5, thus fixing a documentation bug reported by Schelte Bron back in 2014. See https://core.tcl-lang.org/tk/tktview?name=279b027fd7 |