p-lr / p-lr/MapComposeMP

creating a trail with paths

Open
#48 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
130
Forks
12
PR merge metrics
No merged PRs in 30d

Description

i am trying to add a "tail" to some GPS movements on a map.
i am using path. but i cant seem to find out how to just add a new segment to the front and remove the last segment at the end.
so i got this silly hack now, always removing the full path and creating a new one.
this works but it flickers, and also is ugly.

any help on using the path API properly?

points is:

val points = mutableListOf<Pair<Double, Double>>()
a list of asNormalizedWebMercator gps coords of the last movement of the "person"

// HACK - HACK - HACK
// HACK - HACK - HACK
GlobalViewModels.osm.state.removeAllPaths()
GlobalViewModels.osm.state.addPath(id = "" + (path_global_hackish_id_cur + 1) + ":::trail:::" + fpubkey) {
    addPoints(points)
}
path_global_hackish_id_cur++
if (path_global_hackish_id_cur > 1000)
{
    path_global_hackish_id_cur = 1
}
// HACK - HACK - HACK
// HACK - HACK - HACK

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the path API around addPath and addPoints, using the supplied points list and current removeAllPaths/recreate flow as the reproduction. Done means a trail can add the newest segment and remove the oldest without rebuilding the whole path or flickering; confirm the behavior on a moving GPS path.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.