Skip to content

Cannot read property 'updateContent' of undefined #822

Closed

Description

  • I'm reporting a bug, not asking for help
  • I've looked at the documentation to make sure the behaviour is documented and expected
  • I'm sure this is a Leaflet Draw code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

How to reproduce

  • Leaflet version I'm using: 1.2.0
  • Leaflet Draw version I'm using: 1.0.0
  • Browser (with version) I'm using: Chrome 63.0.3239.132
  • OS/Platform (with version) I'm using: macOS 10.13.2
  1. Set up a map with Leaflet + Leaflet.draw
  2. Set up a circle in drawnItems
  3. Manually enable editing (not using the toolbar)
  4. Try to resize it

What behaviour I'm expecting and which behaviour I'm seeing

Should be able to manually edit shapes (I control the editing behaviour so users can only edit one shape at a time), but get this updateContent error

Minimal example reproducing the issue

  • this example is as simple as possible
  • this example does not rely on any third party code

This jsfiddle reproduces the problem faithfully. Check the console log for the error - it's due to line 35 in this file.
The problem here is that _editTooltip hasn't been set up because noone clicked the pencil 'edit' button in the toolbar, since the edit state is triggered manually.
A simple if (this._map.hasOwnProperty('_editTooltip')) {… here would fix this, but I don't know if you want to cater for this eventuality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions