[Bug]: Draw template number fields reject valid decimals (e.g. 1.2 with step 0.1) due to floating-point step check
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
The check lives in DrawTool_Templater.js, in getTemplateValues, in the number case, where the quotient values[t.field] / t.step is compared with parseInt of itself. Run the node one-liner from the issue to confirm which values fail, then replace the comparison with a tolerance test against the nearest integer. Done when 1.2 with step 0.1 saves, and a value that is not a multiple of the step is still rejected.
Written by the indexing model from the issue text.
Description
Checked for duplicates
Yes - I've already checked
Describe the bug
When I save a Draw feature whose property template has a number field with a decimal step (e.g. step: 0.1), many valid values are rejected. Entering 1.2 and pressing Save All Changes shows:
This feature has invalid form values: 'canopy_height_m' must be a multiple of 0.1
and the feature is not saved.
The check in DrawTool_Templater.js (getTemplateValues, the number case; line ~427 on development) compares a floating-point quotient to its integer part:
values[t.field] / t.step != parseInt(values[t.field] / t.step)
In IEEE-754, 1.2 / 0.1 === 11.999999999999998, so parseInt gives 11 and the value is "not a multiple". For step: 0.1, 16 of the 50 values from 0.1 to 5.0 are rejected: 0.3, 0.6, 0.7, 1.2, 1.4, 1.9, 2.3, 2.4, 2.8, 2.9, 3.3, 3.8, 4.1, 4.3, 4.6, 4.8. step: 0.01 is affected the same way.
The user sees a validation error for a correct value and has no way to enter it.
What did you expect?
I expected any value that is a whole number of steps from 0 (to within floating-point tolerance) to be accepted. For example:
const q = values[t.field] / t.step
if (Math.abs(q - Math.round(q)) > 1e-9) invalids[t.field] = `'${t.field}' must be a multiple of ${t.step}`
(Relative to min rather than 0 may also be intended, as in HTML <input step>, but that is a separate question.)
Reproducible steps
1. Give a Draw file a template with: { "type": "number", "field": "h", "label": "Height", "min": 0, "max": 50, "step": 0.1 }
2. Draw a feature in that file and open its properties.
3. Enter 1.2 in Height and press "Save All Changes".
4. Toast: "This feature has invalid form values: 'h' must be a multiple of 0.1". Not saved.
(1.5 or 1.0 save fine.)
# Quick check of the arithmetic:
node -e 'for(let i=1;i<=50;i++){const v=+(i/10).toFixed(1);if(v/0.1!=parseInt(v/0.1))console.log(v)}'
Environment
- MMGIS: present on `development` (5.3.15-20260825); the comparison dates from the original templates feature (#353)
- Seen on: iPad Pro 13" (2025), iOS 26.4, WKWebView; also reproducible in any browser, as it is pure arithmetic
- Dominant language
- JavaScript
- Stars
- 242
- Forks
- 86
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 15
Getting set up
- Ships a 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 NASA-AMMOS/MMGIS
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NASA-AMMOS/MMGIS#963 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
NASA-AMMOS/MMGIS#1163 · 1 comment ·
Maintainers usually reply within 1 day
-
[New Feature]: Identifier — click a point to chart time-enabled layers over the time rangePossibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 56/100
NASA-AMMOS/MMGIS#1159 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
NASA-AMMOS/MMGIS#1156 ·
Maintainers usually reply within 1 day
-
[Bug]: Adjacent servers in containers: in-container servers fail silently without a per-server .env, run unused under Docker, and the proxy target flips between Docker and PodmanPossibly taken @jl-0 claimed this 11 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
NASA-AMMOS/MMGIS#1138 ·
Maintainers usually reply within 1 day
All issues in NASA-AMMOS/MMGIS
Similar issues
-
Entity picker filter keeps the first kind's groups after switching Specific Term / Specific PostOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
davidofchatham/bws-gb-dynamic-tags-extensions#177 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
ioBroker/ioBroker.zigbee#3069 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
has-image has-license has-readme new-tool ready-to-approve repo-verified
Difficulty 1/5 Under an hour Newbie friendliness 78/100
shanselman/TinyToolTown#957 ·
Maintainers usually reply within 2 days
-
Sign-in page: label GitHub as for Team Managers and Google as for Team MembersPossibly taken @StatsLateral claimed this today. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
StatsLateral/teamctx#343 · 1 comment ·
Maintainers usually reply within 1 day