Skip to content

Commit b2f1023

Browse files
committed
fix: added feature varaible
1 parent 594194a commit b2f1023

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/GEOComp.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ var GEOComp = (function () {
160160
menuContent: stringSimpleControl(""),
161161
events: jsonObjectExposingStateControl("events"),
162162
event: jsonObjectExposingStateControl("event"),
163+
feature: jsonObjectExposingStateControl("feature"),
163164
buttons: withDefault(JSONObjectControl, "{menu:false,north:false,save:false}"),
164165
features: withDefault(
165166
JSONObjectControl,
@@ -189,7 +190,7 @@ var GEOComp = (function () {
189190
autoHeight: boolean;
190191
events: any;
191192
event: any;
192-
map: any;
193+
feature: any
193194
}) => {
194195
const doDebug = function () { return props.defaults && props.defaults.debug === true }
195196
//Cache for all events
@@ -214,6 +215,9 @@ var GEOComp = (function () {
214215
switch (name) { //Catch first on name
215216
case 'map:create':
216217
return //Internal event only, user should use map:init
218+
case 'click:feature':
219+
props.feature.onChange(eventObj)
220+
break;
217221
default:
218222
switch (eventName) {
219223
case 'bbox':
@@ -376,16 +380,6 @@ GEOComp = withMethodExposing(GEOComp, [
376380
animate(map, params[0], params?.[1], params?.[2], params?.[3])
377381
}
378382
},
379-
{
380-
method: {
381-
name: "feature",
382-
params: [],
383-
description: "Return the last feature clicked",
384-
},
385-
execute: async (comp: any, params: any) => {
386-
return comp.exposingValues.events['click:feature'] || {}
387-
}
388-
},
389383
{
390384
method: {
391385
name: "map",
@@ -506,4 +500,5 @@ export default withExposingConfigs(GEOComp, [
506500
new NameConfig("events", trans("component.events")),
507501
new NameConfig("event", trans("component.event")),
508502
new NameConfig("bbox", trans("component.bbox")),
503+
new NameConfig("feature", trans("component.feature")),
509504
]);

src/i18n/comps/locales/en.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export const en = {
3838
"center": "center",
3939
"designer": "Designer mode",
4040
"buttons": "Buttons",
41-
"showLogo": "Show logo"
41+
"showLogo": "Show logo",
42+
"feature": "feature"
4243
},
4344
"methods": {
4445
"xml": "Get XML",

0 commit comments

Comments
 (0)