Commit Graph

60 Commits

Author SHA1 Message Date
Tim Schaub
e72b383976 Required return from event handler 2014-04-10 06:32:27 -06:00
Éric Lemoine
baca25ed95 Fix bug at modify interaction construction time
This fixes a bug that occurs when the modify interaction is configured with a non-empty collection of features.
2014-04-10 11:00:00 +02:00
Éric Lemoine
ce0b1d2a47 Use goog.functions.identity where it makes sense 2014-04-07 16:59:04 +02:00
ahocevar
bf06129256 Initialize snappedToVertex_ 2014-04-04 14:11:02 +02:00
ahocevar
523b51d69a Add missing goog.requires; fix types and a typo 2014-04-04 14:05:19 +02:00
ahocevar
f2acbd332c Use the pixelTolerance to determine whether to snap to a vertex 2014-04-04 14:05:19 +02:00
ahocevar
8fc9b23ab8 Do not return as handled unless a geometry was modified
With this change, it is more straightforward to determine
whether an event is considered as handled, which results in the
removal of the modifiable_ and lastVertexCoordinate_ states.
Instead, we only need to know whether we're on a real vertex or
a virtual one. For that a new snappedToVertex_ flag is
introduced.

To stop a click after vertex deletion from triggering a feature
selection, vertex deletion is now triggered by a configurable
event condition, which defaults to singleclick (same as in the
select interaction) with no modifier keys.
2014-04-04 14:05:18 +02:00
Antoine Abt
5cc1a986c2 Share editing default styles 2014-03-31 10:24:17 +02:00
Éric Lemoine
c82d5ba88e Make the Modify interaction more robust
This prevents a JavaScript error when features are added while the interaction does not have a map.
2014-03-28 16:09:52 +01:00
Éric Lemoine
afa5f35cef Create the R-Tree in the Modify constructor
In this way features can be added/removed to/from the R-Tree even when the interaction does not have a map.
2014-03-28 16:07:03 +01:00
Éric Lemoine
c33a3372d9 Fix initial state of the Modify interaction
Features that are in the features collection need to be added to the R-Tree.
2014-03-28 16:03:34 +01:00
ahocevar
8b99fd9bc1 Updates to pass jshint validation 2014-03-28 12:02:08 +01:00
ahocevar
b9cd512ffc Lower pixel tolerance to avoid accidental vertex deltion 2014-03-28 11:37:06 +01:00
ahocevar
e612330dd7 Add a way to delete vertices with the Modify interaction
After this change, vertices can be deleted by simply clicking on
them. This is the same behaviour as e.g. in geojson.io.
2014-03-28 11:36:13 +01:00
ahocevar
878f7cc7c8 Do not update RTree while dragging vertices 2014-03-19 11:36:55 +01:00
ahocevar
6de1636507 Initialize lastPixel_ properly 2014-03-14 15:24:58 +01:00
tsauerwein
d6ca93e23c Adding missing return 2014-03-14 10:16:26 +01:00
ahocevar
d6880039cc Making the draw interaction work with pointer events
This is not yet optimized for mobile, and tests need to be
updated.
2014-03-14 10:16:26 +01:00
ahocevar
be1318f133 Adding basic support for non-mouse devices 2014-03-14 10:16:26 +01:00
ahocevar
f6efcbcc24 The Modify interaction now uses pointer events
While dragging a vertex, the feature on the original layer is
not updated until the first pointer move after dragging. See
#1796. Previously, the Modify interaction did not set the
interacting hint on the view, so the feature was also updated
on the original layer. But now, the interacting hint is set,
which exposes this behaviour.
2014-03-14 10:16:26 +01:00
ahocevar
ecddcdd732 Add support for editing interior polygon rings 2014-03-13 01:02:15 +01:00
Andreas Hocevar
1fbdf47e2a Merge pull request #1807 from ahocevar/float-no-zero
Modify interaction sometimes does not allow to create a new vertex
2014-03-13 00:51:43 +01:00
ahocevar
62034e8fb9 Only update the index for the current component 2014-03-12 13:02:52 +01:00
ahocevar
bc79b89c5e Limit shared segment editing
To avoid surprises, we enable shared segment editing only on
segments that have the same vertex coordinates.
2014-03-07 10:52:50 +01:00
ahocevar
42935408fb Keep track of intersecting segments
Because we have nodes sorted by segment distance from the
editing vertex in #handleMouseAtPixel(), it is cheap to create a
hash of intersecting segments there. Now in #handleDragStart(),
we do not need to measure the distance of the vertex to the
segment. Instead, we just test if the segment is in the hash.
2014-03-07 10:52:49 +01:00
Tom Payne
e5ee44f8ad Rename ol.structs.RBush#getAllInExtent to getInExtent 2014-03-06 14:30:56 +01:00
Antoine Abt
ec832bdf6e Modify interaction takes style & features options
Instead of a FeatureOverlay
2014-02-21 12:35:30 +01:00
Éric Lemoine
db83b11eee Modify interaction doesn't need to store styles 2014-02-16 16:15:11 +01:00
Antoine Abt
f8a748d7f4 Fix MultiPoint modify 2014-02-12 15:26:57 +01:00
Antoine Abt
56a1f053ff Check geometry type instead of instanceof 2014-02-12 15:25:47 +01:00
Antoine Abt
03624b5f78 Check segment writers existence 2014-02-11 14:36:54 +01:00
Antoine Abt
f9b6eabfef %s/render.FeaturesOverlay/FeatureOverlay/ 2014-02-10 11:26:14 +01:00
Antoine Abt
0272659118 Remove useless style method 2014-02-10 11:26:14 +01:00
Antoine Abt
72675bf6ad Make interaction ctor only have an option object 2014-02-10 11:26:13 +01:00
Antoine Abt
5325af26d6 Store mouse last position to draw vertex at feature selection 2014-02-10 11:26:13 +01:00
Antoine Abt
e64766f01f Add support for GeometryCollection in modify interaction 2014-02-10 11:26:13 +01:00
Antoine Abt
a60203f931 Move segment writers in their own methods 2014-02-10 11:26:13 +01:00
Antoine Abt
933ef64db1 Force remove vertexFeature when there’s no features left in FeaturesOverlay 2014-02-07 14:52:59 +01:00
Antoine Abt
fb637aedca Move variables declaration at the top 2014-02-07 14:52:59 +01:00
Antoine Abt
a1d20182fe Make modify interaction use FeaturesOverlay
Instead of a whole map.
2014-02-07 14:52:58 +01:00
oterral
3155d681be Add modify feature interaction and its example 2014-02-07 14:52:57 +01:00
Tom Payne
4e65fefc00 Move vector code out of the way 2013-11-20 11:39:21 +01:00
Tim Schaub
15b73ca87e Merge pull request #1293 from tschaub/event-element
Correctly handle layer add/remove in modify interaction.
2013-11-19 09:53:25 -08:00
Tim Schaub
3fbbdb78d5 Call getElement to get layer 2013-11-19 09:52:27 -07:00
ahocevar
936f86568e Merge pull request #1284 from ahocevar/null-vertexfeature
Protect from null vertexFeature
2013-11-18 12:23:00 -08:00
ahocevar
aa5358203e Protect from null vertexFeature
When dragging the map before a vertexFeature was created, it can
be null, so we cannot get its renderIntent.
2013-11-18 10:43:37 +01:00
Tim Schaub
b0362b8c0a Only set interacting hint when modifying the view 2013-11-14 14:21:01 -07:00
ahocevar
f790992a77 Make addLayer and removeLayer methods private 2013-11-13 00:44:39 +01:00
ahocevar
b805a76ae1 layerFilter can no longer be undefined here 2013-11-13 00:44:39 +01:00
ahocevar
4e85322abb Minor stylistic clean-ups and more symmetry 2013-11-13 00:44:38 +01:00