question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get coordinates for first/last available position

See original GitHub issue

Hi, is it possible to upgrade the library with two additional methods to return coordinates of first available position and coordinates of last available position? Something like getFirstAvailablePostion() and getLastAvailablePostion(). getNextPossiblePosition() returns only if there is an available position, but not where it is. I’ve looked into source code, and I think that it could be done by modifying this code to:

    for (; rowsIndex < this.rows; rowsIndex++) {
      newItem.y = rowsIndex;
      colsIndex = 0;
      for (; colsIndex < this.columns; colsIndex++) {
        newItem.x = colsIndex;
        if (!this.checkCollision(newItem)) {
          return [newItem.x, newItem.y]; // <- actual modification
        }
      }
    }

For last item, newItem x and y could start with max values, and then decrement in for loops.

I would actually try to do and test this myself, but I’m noob and couldn’t figure out why this.options.api.getNextPossiblePosition({ ... }) throws an error (Object is possibly undefined) and won’t compile in the cloned repo.

Also, thanks for the library. It’s a life saver, and really easy to use.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tiberiuzuldcommented, Feb 19, 2018

Ok will try to add last available position callback in version 5.0

1reaction
tiberiuzuldcommented, Feb 27, 2018

Hi @petarGitNik , This feature was added in v4.7.0 Thanks to @NoMercy235

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the endpoint of a LineString in Shapely
For accessing single points from a coordinate sequence, use numpy. So, instead of: first = Point(line.coords[0]) last = Point(line.coords[-1]).
Read more >
First and last point of MultiLineString-objects in QGIS 3
So far i have been able to iterate the features and found out that ArcGIS's export created a MulitLineString with a number of...
Read more >
Discover coordinates or search by latitude & longitude
To search for a place, enter the latitude and longitude GPS coordinates on Google Maps. You can also find the coordinates of the...
Read more >
How to find position of first/last number in a text string in Excel?
Actually, using formula will help you quickly find the position of first/last number in a specified text string. In this tutorial, we will...
Read more >
Locate Coordinates (Latitude and Longitude) on Google Maps
Free service to locate coordinates (latitude and longitude) on Google Maps, useful if you have latitude and longitude and you want to know...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found