kopia lustrzana https://github.com/robhawkes/vizicities
Added off-state event for hover picking
rodzic
fb49a43629
commit
9904d99d7b
|
@ -9110,8 +9110,6 @@ if (typeof window === undefined) {
|
|||
self.world.addPickable(mesh, geom.id);
|
||||
|
||||
VIZI.Messenger.on("pick-hover:" + geom.id, function() {
|
||||
console.log("Hovered:", geom.id);
|
||||
|
||||
self.lastPickedId = geom.id;
|
||||
|
||||
if (self.pickedMesh) {
|
||||
|
@ -9140,6 +9138,12 @@ if (typeof window === undefined) {
|
|||
self.add(self.pickedMesh);
|
||||
});
|
||||
|
||||
VIZI.Messenger.on("pick-off:" + geom.id, function() {
|
||||
if (self.pickedMesh) {
|
||||
self.remove(self.pickedMesh);
|
||||
}
|
||||
});
|
||||
|
||||
VIZI.Messenger.on("pick-click:" + geom.id, function() {
|
||||
// TODO: Do something to the choropleth when clicked
|
||||
console.log("Clicked:", geom.id);
|
||||
|
@ -10168,6 +10172,8 @@ if (typeof window === undefined) {
|
|||
* @author Robin Hawkes - vizicities.com
|
||||
*/
|
||||
|
||||
// TODO: Emit event when finished hovering a ref - "pick-off:id"?
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
@ -10210,11 +10216,19 @@ if (typeof window === undefined) {
|
|||
var ref = self.pick(relativePos);
|
||||
|
||||
if (!ref) {
|
||||
if (self.lastPickedIdHover) {
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
VIZI.Messenger.emit("pick-off:" + self.lastPickedIdHover);
|
||||
self.lastPickedIdHover = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.lastPickedIdHover && self.lastPickedIdHover === ref.id) {
|
||||
return;
|
||||
} else if (self.lastPickedIdHover && self.lastPickedIdHover !== ref.id) {
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
VIZI.Messenger.emit("pick-off:" + self.lastPickedIdHover);
|
||||
}
|
||||
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -165,8 +165,6 @@
|
|||
self.world.addPickable(mesh, geom.id);
|
||||
|
||||
VIZI.Messenger.on("pick-hover:" + geom.id, function() {
|
||||
console.log("Hovered:", geom.id);
|
||||
|
||||
self.lastPickedId = geom.id;
|
||||
|
||||
if (self.pickedMesh) {
|
||||
|
@ -195,6 +193,12 @@
|
|||
self.add(self.pickedMesh);
|
||||
});
|
||||
|
||||
VIZI.Messenger.on("pick-off:" + geom.id, function() {
|
||||
if (self.pickedMesh) {
|
||||
self.remove(self.pickedMesh);
|
||||
}
|
||||
});
|
||||
|
||||
VIZI.Messenger.on("pick-click:" + geom.id, function() {
|
||||
// TODO: Do something to the choropleth when clicked
|
||||
console.log("Clicked:", geom.id);
|
||||
|
|
|
@ -49,11 +49,19 @@
|
|||
var ref = self.pick(relativePos);
|
||||
|
||||
if (!ref) {
|
||||
if (self.lastPickedIdHover) {
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
VIZI.Messenger.emit("pick-off:" + self.lastPickedIdHover);
|
||||
self.lastPickedIdHover = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.lastPickedIdHover && self.lastPickedIdHover === ref.id) {
|
||||
return;
|
||||
} else if (self.lastPickedIdHover && self.lastPickedIdHover !== ref.id) {
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
VIZI.Messenger.emit("pick-off:" + self.lastPickedIdHover);
|
||||
}
|
||||
|
||||
// Emit event with picked id (for other modules to reference from)
|
||||
|
|
Ładowanie…
Reference in New Issue