-
Notifications
You must be signed in to change notification settings - Fork 0
Selection API #1
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,9 +107,30 @@ export class CircleSelect extends FSM { | |
|
|
||
| if (typeof callback === "function") { | ||
| let objList = Selector.getObjects(s, view); | ||
|
|
||
| view.selectObjects(objList); | ||
| callback(objList); | ||
| } | ||
|
|
||
| var region_callback = view.aladin.callbacksByEventName['regionSelected']; | ||
| if (typeof region_callback === "function") { | ||
| let startCooWorld = view.aladin.pix2world(this.startCoo.x, this.startCoo.y); | ||
| let radius = view.aladin.angularDist( | ||
| this.startCoo.x, | ||
| this.startCoo.y, | ||
| this.coo.x, | ||
| this.coo.y | ||
| ); | ||
|
|
||
| region_callback({ | ||
| type: "circle", | ||
| startCoo: { | ||
| ra: startCooWorld[0], | ||
| dec: startCooWorld[1] | ||
| }, | ||
| radius: radius, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // execute selection callback only | ||
|
|
@@ -134,14 +155,36 @@ export class CircleSelect extends FSM { | |
| view.aladin.removeStatusBarMessage('selector') | ||
| }; | ||
|
|
||
| let api = (params) => { | ||
| let startCoo = params["startCoo"]; | ||
| let endCoo = params["endCoo"]; | ||
|
|
||
| let startCooPix = view.aladin.world2pix(startCoo["ra"], startCoo["dec"]); | ||
| let endCooPix = view.aladin.world2pix(endCoo["ra"], endCoo["dec"]); | ||
|
|
||
|
|
||
| this.startCoo = { | ||
| x: startCooPix[0], | ||
| y: startCooPix[1], | ||
| }; | ||
|
|
||
| this.dispatch('mouseup', { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These uses of mouse events to define a selection region are good places to highlight as we discuss the challenges of moving between sky regions and screen coordinates. For these in particular, unless one is zoomed in a centered around the region, it's pretty easy for the sky coordinates needed to not be on the screen. |
||
| coo: { | ||
| x: endCooPix[0], | ||
| y: endCooPix[1], | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| super({ | ||
| state: 'off', | ||
| transitions: { | ||
| off: { | ||
| start, | ||
| }, | ||
| start: { | ||
| mousedown | ||
| mousedown, | ||
| api, | ||
| }, | ||
| mousedown: { | ||
| mousemove | ||
|
|
@@ -162,6 +205,9 @@ export class CircleSelect extends FSM { | |
| }, | ||
| mouseup: { | ||
| off, | ||
| }, | ||
| api: { | ||
| mouseup | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -443,6 +443,11 @@ export let View = (function () { | |
| this.selector.start(mode, callback); | ||
| } | ||
|
|
||
| View.prototype.regionSelection = function(region, callback) { | ||
| this.selector.start(region["selection_type"], callback); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the callback being given to Along the same lines, I wonder if the the next line, |
||
| this.selector.dispatch("api", region); | ||
| } | ||
|
|
||
| View.prototype.setMode = function (mode) { | ||
| this.mode = mode; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more informative name for
api?