[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] maps: Another fix for multi-layer maps with other vector layers apart...
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6998539a36dde_3b186e601278e@gitlab-sidekiq-low-urgency-cpu-bound-v2-5c86845cdd-7v84z.mail> |
Jonny Bradley pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki
Commits:
96c1b7bb by Jonny Bradley at 2026-02-20T12:18:19+00:00
[FIX] maps: Another fix for multi-layer maps with other vector layers apart...
---
* [FIX] maps: Another fix for multi-layer maps with other vector layers apart from `container.vectors` to make the "select/modify" tool work again.
Sadly not possibly to merge into master due to code removal there, but will need doing at some point for Cartograf on 30.x
See merge request tikiwiki/tiki!9618
- - - - -
2 changed files:
- lib/jquery_tiki/tiki-maps.js
- lib/wiki-plugins/wikiplugin_appframe.php
Changes:
=====================================
lib/jquery_tiki/tiki-maps.js
=====================================
@@ -356,6 +356,13 @@
event.feature.executor();
}
$(container).setMapPopup(null);
+
+ if (modifyControl && modifyControl.active && event.feature) {
+ modifyControl.unselectFeature(event.feature);
+ }
+ if (modifySelectControl && modifySelectControl.active && event.feature) {
+ event.feature.layer.drawFeature(event.feature, "default");
+ }
},
featuremodified: function (event) {
if (event.feature.executor) {
@@ -683,7 +690,7 @@
};
container.getLayer = function (name) {
- var vectors;
+ let vectors;
if (name) {
if (! container.layers[name]) {
@@ -705,6 +712,13 @@
selectControl.deactivate();
selectControl.activate();
}
+ container.modeManager.modes.forEach(function(mode) {
+ mode.controls.forEach(function(control) {
+ if (control.displayClass === "olControlSelectFeature") {
+ control.setLayer(vectorLayerList);
+ }
+ });
+ });
}
return container.layers[name];
@@ -1075,16 +1089,12 @@
form.autoLayers.push(layerName);
}
- let icon = "";
- try {
- $(i.link).each(function () {
- // if the object has an img with it (tracker status for instance) then we need to find the <a>
- if ($(this).is("a")) {
- // and just using $(i.link).find("a") doesn't work for some reason
- icon = $(this).data("icon-src");
- }
- });
- } catch (e) {}
+ var icon;
+ $(i.link).each(function () { // if the object has an img with it (tracker status for instance) then we need to find the <a>
+ if ($(this).is("a")) { // and just using $(i.link).find("a") doesn't work for some reason
+ icon = $(this).data('icon-src');
+ }
+ });
if (i.geo_location) {
$(container).addMapMarker({
@@ -1148,21 +1158,26 @@
initial = wkt.write(feature) + feature.attributes.color;
feature.executor = delayedExecutor(5000, function () {
- var fields = {}, current = wkt.write(feature) + feature.attributes.color;
+ let fields = {},
+ current = wkt.write(feature) + feature.attributes.color;
+
fields[i.geo_feature_field] = format.write(feature);
- if (current === initial || layer !== container.vectors) {
+ if (current === initial || layer.id.indexOf("OpenLayers.Layer.Vector") === -1) {
+ // not changed or not a vector layer
return;
}
- $.post($.service('tracker', 'update_item'), {
- trackerId: i.tracker_id,
- itemId: i.object_id,
- fields: fields
- }, function () {
- initial = current;
- }, 'json')
- .on("error", function () {
+ $.post(
+ $.service('tracker', 'update_item'),
+ {
+ trackerId: i.tracker_id,
+ itemId: i.object_id,
+ fields: fields
+ }, function () {
+ initial = current;
+ }, 'json')
+ .error(function () {
$(container).trigger('changed');
});
});
=====================================
lib/wiki-plugins/wikiplugin_appframe.php
=====================================
@@ -437,16 +437,25 @@ function wikiplugin_appframe_mapcontrol($data, $params, $start)
}
break;
case 'select_feature':
- $control = $ol2 ? 'new OpenLayers.Control.SelectFeature(vlayer)' : '';
+ $control = $ol2 ? 'new OpenLayers.Control.SelectFeature([vlayer])' : '';
$label = tr('Select');
break;
case 'modify_feature':
- $control = $ol2 ? 'new OpenLayers.Control.ModifyFeature(vlayer, {
- mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE,
- standalone: true,
- virtualStyle: drawStyle,
- vertexRenderIntent: "vertex"
- }), new OpenLayers.Control.SelectFeature(vlayer)' : '';
+ $control = $ol2 ? 'modifyControl = new OpenLayers.Control.ModifyFeature(vlayer, {
+ mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE,
+ standalone: true,
+ virtualStyle: drawStyle,
+ vertexRenderIntent: "vertex",
+ autoActivate: true
+}), modifySelectControl = new OpenLayers.Control.SelectFeature([vlayer], {
+ autoActivate: true,
+ onSelect: function (feature) {
+ modifyControl.selectFeature(feature);
+ },
+ onUnselect: function (feature) {
+ //modifySelectControl.unselect(feature);
+ }
+})' : '';
$label = tr('Select/Modify');
break;
case 'draw_polygon':
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/96c1b7bb28b4abf2fcc75e7a22e28021d32387c9
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/96c1b7bb28b4abf2fcc75e7a22e28021d32387c9
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs