Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
316 stars 157 forks source link

[Map] Closing a marker popup should not reset the map zoom/bounds #259

Closed rudokemper closed 4 years ago

rudokemper commented 5 years ago

This is an easy fix: when you close a popup, it should not reset the map view to home.

(If you're looking at a bunch of clustered markers close by each other, it's a little annoying to have to keep zooming in to examine the others.)

rudokemper commented 5 years ago

Studying Map.jsx a little, I can tell that both the filter map reset as well as the close-marker map reset (and just about any other action) are handled by the else in this conditional;

      if (this.map) {
        this.map.panTo(this.props.pointCoords);
      }
      return;
    } else {
      if (this.map) {
        this.resetMapToCenter();
      }
    }
  } 

But I'm not sure how to take it from here. Maybe a specific conditional for if-marker-popup-is-closed, doNothing; or alternatively, a default action of doNothing except for when filters are cleared, in which case, resetMapToCenter.

leosoaivan commented 4 years ago

May I attempt this one?

kalimar commented 4 years ago

Yeah definitely! Please let us know if you need any clarification or maybe a screen video.

leosoaivan commented 4 years ago

I posted in the slack, but perhaps issues related to this ticket belong here :)

Ran into a pending migration error after docker-compose up:

Starting terrastories_db_1 ... done
Starting terrastories_web_1 ... done
Attaching to terrastories_db_1, terrastories_web_1
db_1   | 2019-10-08 11:08:40.449 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
web_1  | wait-for-it.sh: waiting 15 seconds for db:5432
db_1   | 2019-10-08 11:08:40.449 UTC [1] LOG:  listening on IPv6 address "::", port 5432
web_1  | wait-for-it.sh: db:5432 is available after 0 seconds
db_1   | 2019-10-08 11:08:40.452 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2019-10-08 11:08:40.465 UTC [25] LOG:  database system was shut down at 2019-10-08 11:08:36 UTC
db_1   | 2019-10-08 11:08:40.470 UTC [1] LOG:  database system is ready to accept connections
db_1   | 2019-10-08 11:08:41.042 UTC [32] LOG:  incomplete startup packet
web_1  | => Booting Puma
web_1  | => Rails 5.2.3 application starting in development
web_1  | => Run `rails server -h` for more startup options
web_1  | Puma starting in single mode...
web_1  | * Version 3.12.1 (ruby 2.5.1-p57), codename: Llamas in Pajamas
web_1  | * Min threads: 5, max threads: 5
web_1  | * Environment: development
web_1  | * Listening on tcp://0.0.0.0:3000
web_1  | Use Ctrl-C to stop
web_1  | Started GET "/" for 172.18.0.1 at 2019-10-08 11:10:09 +0000
web_1  | Cannot render console from 172.18.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1  |    (1.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
web_1  |   ↳ /usr/local/bundle/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
web_1  |
web_1  | ActiveRecord::PendingMigrationError - Migrations are pending. To resolve this issue, run:
web_1  |
web_1  |         bin/rails db:migrate RAILS_ENV=development
web_1  |
web_1  | :
web_1  |
web_1  | Started POST "/__better_errors/f0208c5f296cbe80/variables" for 172.18.0.1 at 2019-10-08 11:10:09 +0000
web_1  | Cannot render console from 172.18.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255

Any ideas? I'm wary of actually running the migration command since I'm unfamiliar with Docker.

rudokemper commented 4 years ago

I tried to implement the changes to the code from this PR (https://github.com/Terrastories/terrastories/pull/298) in the latest version of master, but it seems that something in the current resetStoriesAndMap code is trigging this.resetMapToCenter regardless of separating out the pointCoords array into a separate handler as was proposed. I'm not sure where the behavior in question is being triggered, yet.

rudokemper commented 4 years ago

Could this be related to https://github.com/Terrastories/terrastories/issues/423?