[Bug]: moveToken is one square off every N calls for tokens smaller than medium
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start with TokenLocationFunctions.java and inspect moveToken, especially the pixel-offset adjustment and the conversion to a ZonePoint. Reproduce the report by repeatedly calling moveToken(0, 0, 1, getSelected()) with a token smaller than medium; done means repeated calls leave the token at (0, 0).
Written by the indexing model from the issue text.
Description
Describe the Bug
[moveToken(0, 0, 1, getSelected())] called repeatedly sometimes moves the token to (-1, -1).
This happens only for tokens with size smaller than "medium".
This happens only for "units" = 1, moveToken(0, 0, 0, ...) works as expected.
If the token is small, it lands every 8 calls on (-1, -1)
If the token is tiny or smaller it lands every 4 calls on (-1, -1)
Without understanding quite what happens here, I suspect this code might be the problem:
Its in TokenLocationFunctions.java:moveToken
if (useDistance) {
// Remove pixel offset, so that getTokenX / getTokenY and coordinates match. Fixes #1757.
Point offset = getInstance().getTokenPixelLocationOffset(token);
x -= offset.x;
y -= offset.y;
}
ZonePoint zp = getZonePoint(x, y, useDistance);
MapTool.serverCommand().updateTokenProperty(token, Token.Update.setXY, zp.x, zp.y);
This happens with other coordinates, too, (0, 0) is just an example.
To Reproduce
Add a token to your map, select it and set its size to smaller than "medium".
Execute [moveToken(0, 0, 1, getSelected())] in the chat window repeatedly.
If you impersonate the token, [moveToken(0, 0)] will give the same buggy result.
Expected Behaviour
The Token is moved to (0, 0) and stays there for every subsequent call.
Screenshots
No response
MapTool Info
1.18.6, Jar-Install
Desktop
Linux (Gentoo)
Additional Context
==== MapTool Information ====
MapTool Version: 1.18.6
MapTool Home...: /home/stephan/.maptool-rptools
MapTool Install: /home/stephan/Anwendungen/MapTool-1.18.6/lib/app
Max mem avail..: 23 GB
Max mem used...: 272 MB
Custom Property: -DMAPTOOL_LOGDIR=/home/stephan/.maptool-rptools/logs
Custom Property: -DMAPTOOL_DATADIR=.maptool-rptools
==== Java Information ====
Java Home......: /home/stephan/Anwendungen/MapTool-1.18.6/lib/runtime
Java Vendor....: Eclipse Adoptium
Java Version...: 21.0.1
Java Parameters:
-Djpackage.app-version=1.0
-Xss8M
-Dsun.java2d.d3d=true
-Dsentry.environment=Production
-Dfile.encoding=UTF-8
-Dpolyglot.engine.WarnInterpreterOnly=false
-Djava.util.Arrays.useLegacyMergeSort=true
-XX:+ShowCodeDetailsInExceptionMessages
--add-opens=java.desktop/java.awt=ALL-UNNAMED
--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED
--add-opens=java.desktop/sun.awt.geom=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=javafx.web/javafx.scene.web=ALL-UNNAMED
--add-opens=javafx.web/com.sun.webkit=ALL-UNNAMED
--add-opens=javafx.web/com.sun.webkit.dom=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.desktop/sun.awt=ALL-UNNAMED
--add-opens=java.desktop/sun.java2d=ALL-UNNAMED
--add-opens=java.desktop/javax.swing=ALL-UNNAMED
--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED
--add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
-Duser.country=DE
-Duser.language=de
-Djava.io.tmpdir=/home/stephan/tmp
-Djpackage.app-path=/home/stephan/Anwendungen/MapTool-1.18.6/bin/MapTool
==== OS Information ====
OS Name........: Linux
OS Version.....: 6.18.32-gentoo-r2
OS Architecture: amd64
PATH...........: /usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/21/bin:/usr/lib/llvm/20/bin:/opt/cuda/bin:/home/stephan/.local/share/JetBrains/Toolbox/scripts
Number of Procs: 28
==== User Information ====
User Name: stephan
User Home: /home/stephan
User Dir.: /home/stephan/Anwendungen/MapTool-1.18.6
==== Network Interfaces ====
Display Name..: eno1
Interface Name: eno1
Address...: 192.168.14.6
Display Name..: lo
Interface Name: lo
Address...: 127.0.0.1
Host Address...: 127.0.0.1
Default Gateway: 192.168.14.1
==== Locale Information ====
Country.: Germany
Language: German
Locale..: German (Germany)
Variant.:
==== Encoding Information ====
Default Locale: de_DE
Default Charset: UTF-8
file.encoding: UTF-8
sun.jnu.encoding: UTF-8
Default Encoding: UTF8
==== Display Information ====
Number of Displays: 3
Display 1: 5760x1080(-1)
Display 2: 1920x1080(-1)
Display 3: 1920x1080(-1)
==== Internet Gateway Devices ====
No IGDs Found!
- Dominant language
- Java
- Stars
- 927
- Forks
- 286
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 94
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RPTools/maptool
-
[Bug]: An initiative list with no current entry logs an error on every changePossibly taken @dwizard0 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
[Maintenance]: Migrate gradle dependency submission to modern alternativePossibly taken @VelpulaGangavardhan claimed this 18 days ago. Opencode-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
RPTools/maptool#6156 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
code-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
Similar issues
-
Cleanup: restore the interrupt flag in AiFailureAnalyzerPossibly taken @Rishankgupta08 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seleniumboot/selenium-boot#258 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
johanhaleby/occurrent#1505 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
FasterXML/jackson-databind#6443 ·
Maintainers usually reply within 1 day
-
Docs: 2 broken linksOpen
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day