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

Right Click / context menu event in agm-marker #1362

Closed
lalitha02 opened this issue Mar 21, 2018 · 13 comments
Closed

Right Click / context menu event in agm-marker #1362

lalitha02 opened this issue Mar 21, 2018 · 13 comments

Comments

@lalitha02
Copy link

lalitha02 commented Mar 21, 2018

Unable to access right click event in AgmMarker

Agm Map doesn't allow the user to create custom right click events as well.

marker.rightMouseClick = new EventEmitter();;
var rightclick = marker._markerManager.createEventObservable('rightclick', marker)
.subscribe(function (e) {
marker.rightMouseClick.emit(e);
});
marker._observableSubscriptions.push(rightclick);

@sebholstein
Copy link
Owner

We could implement the rightclick event

@s-gbz
Copy link
Contributor

s-gbz commented Jun 13, 2018

Hey there,
I will give it a try next week!

Can you give me a hint where in the code this should be implemented @SebastianM ?
Thanks :)

@lalitha02
Copy link
Author

Thanks for responding. Under the marker directive. Inside marker.d.ts file. So that we could have the right mouse click event exposed to the user.

@s-gbz
Copy link
Contributor

s-gbz commented Jun 29, 2018

Sorry it took so long, it's been a busy week.

Hope this is what you've been looking for @lalitha02 :)

HTML:

<agm-marker (markerRightClick)="onRightClick()">

Typescript:

 onRightClick() {
    console.log("Rightclicked!");
  }

@lalitha02
Copy link
Author

lalitha02 commented Jun 29, 2018 via email

@er-shrey
Copy link

Is it updated in agm 1.0.0 beta-2

Or when we can get this feature in the agm?

If not so soon, do we have any workaround to implement it?

@shaikh-kamran
Copy link

@s-gbz not working

HTML:

<agm-marker (markerRightClick)="onRightClick()">
Typescript:

onRightClick() {
console.log("Rightclicked!");
}

@shaikh-kamran
Copy link

"@agm/core": "^1.0.0-beta.0"

@s-gbz
Copy link
Contributor

s-gbz commented Sep 20, 2018

Hello guys,
sorry to say that I can't help you, because the PR has been merged, but the npm repository wasn't updated yet. Maybe @lazarljubenovic could do sth.

A possible workaround is to clone AGM master from Github and link your application to it. (Google: npm use local or take a look here.
For example, this is the package.json of my demo app. As you can see I'm using AGM with a local path.

{
"name": "agm-test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/_dev": "file:../angular-google-maps",
"@agm/dev": "file:../angular-google-maps",

"@angular/animations": "^6.0.3",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.3",
"@angular-devkit/build-angular": "~0.6.8",
"typescript": "~2.7.2",
"@angular/cli": "~6.0.8",
"@angular/language-service": "^6.0.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
}

@Hect0rr
Copy link

Hect0rr commented Aug 1, 2019

Is there a reason AgmMarker is not cast in EventEmmiter when markerRightClick is raised? You can get AgmMarker object when markerClick is raised.

@Output() markerClick: EventEmitter<AgmMarker> = new EventEmitter<AgmMarker>();
@Output() markerRightClick: EventEmitter<void> = new EventEmitter<void>();

@ghost
Copy link

ghost commented Aug 1, 2019

@Hect0rr the real question is why does markerClick send AgmMarker in the event. Event data is meant to give information about the event, not the target. AgmMarker objects should not be used directly by users of AGM library anyway.

@Hect0rr
Copy link

Hect0rr commented Aug 3, 2019

@doom777 Yeah I agree. But should you get MouseEvent at least?

@ghost
Copy link

ghost commented Aug 4, 2019

Yes, you should. Create a PR.

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

No branches or pull requests

6 participants