Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resetting the bounding box with transform.reset() seems to fail after the first time #34

Closed
dt99jay opened this issue Apr 26, 2018 · 4 comments

Comments

@dt99jay
Copy link

dt99jay commented Apr 26, 2018

When changing a feature's geometry, feature.transform.reset() seems to correctly update the handles the first time, but not for subsequent geometry changes. Here's a minimal example: https://jsfiddle.net/xtv7c7sc/3/
I'm not sure if this is the same issue as #13.

@w8r
Copy link
Owner

w8r commented Nov 27, 2018

Seems to be working

@w8r w8r closed this as completed Nov 27, 2018
@m1900
Copy link

m1900 commented Jan 9, 2019

Unfortunately, I experience the same problem. However, when I change _getBoundingPolygon in Path.Transform.js to

_getBoundingPolygon: function() { return new L.Rectangle( this._path.getBounds(), this.options.boundsOptions); },

by leaving out the geometryToLayer call, the bounding box is sized correctly every time reset is called.

Version used: 1.1.2

@hammad2506
Copy link

If I'm using npm with this, and I don't want to directly modify the source file so others can easily get it working with npm install, how would you suggest me updating the above function? I believe it is not exposed on the transform enabled polyline. Thanks @m1900

Unfortunately, I experience the same problem. However, when I change _getBoundingPolygon in Path.Transform.js to

_getBoundingPolygon: function() { return new L.Rectangle( this._path.getBounds(), this.options.boundsOptions); },

by leaving out the geometryToLayer call, the bounding box is sized correctly every time reset is called.

Version used: 1.1.2

@artuska
Copy link

artuska commented Dec 19, 2019

+1. Issuing the same annoying problem.

@hammad2506 Look at my Leaflet overrides i use to avoid some problems and conflicts between Leaflet plugins:

leaflet.ts:

import * as Leaflet from 'leaflet';

import 'leaflet-draw';
import 'leaflet-editable';
import 'leaflet-path-transform';
import 'leaflet-semicircle';

import 'leaflet.arc';
import 'leaflet.draw-arc';
import 'leaflet.box';
import 'leaflet.draw-box';
import 'leaflet.sector';
import 'leaflet.draw-sector';

Leaflet.Circle.prototype.getCenter = Leaflet.Circle.prototype.getLatLng;

Leaflet.Handler['PathDrag'].prototype.updateLatLng = function() {};

Leaflet.Handler['PathTransform'].prototype._getBoundingPolygon = function() {
    return new Leaflet.Rectangle(this._path.getBounds(), this.options.boundsOptions);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants