Skip to content

Commit

Permalink
fixes #24 user can click and it will collect nearst vertex, shape and…
Browse files Browse the repository at this point in the history
… model file as well as point of intersection with the surface
  • Loading branch information
cesine committed Oct 19, 2014
1 parent 1eecad7 commit 7a8157d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
15 changes: 14 additions & 1 deletion client/js/controllers/MainCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ angular.module('app')
}
}
return data;
}
};
$scope.scatterplot1 = {
options: {
chart: {
Expand Down Expand Up @@ -565,6 +565,19 @@ angular.module('app')
vector: []
}];

$scope.addPointToCurrentMouseMask = function(pick_info) {
$scope.mouseMasks[$scope.mouseMasks.length - 1].vector.push({
modelID: pick_info.object.model_name,
shapeID: pick_info.object.name,
nearestVertex: pick_info.index,
point: pick_info.point
});
console.log("last mask is ", $scope.mouseMasks[$scope.mouseMasks.length - 1]);
if (!$scope.$$phase) {
$scope.$digest(); //$digest or $apply
}
};

$scope.runScript = function(scriptname) {
console.warn("security hole, this should not permit execution of unknown scripts.");
scriptname = scriptname.trim().replace(/[\/\\]+/g, "");
Expand Down
17 changes: 11 additions & 6 deletions client/js/directives/brainbrowser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals angular, console, BrainBrowser, window, document, $, Image, THREE */
"use strict";
/* globals FieldDB */


/**
Expand All @@ -12,8 +12,8 @@ angular.module("app").directive("brainbrowser", function() {

var controller = function($scope, $timeout) {
console.log("Loading brain browser");



};
controller.$inject = ["$scope", "$location", "$timeout"];

Expand All @@ -32,7 +32,7 @@ angular.module("app").directive("brainbrowser", function() {


/// UI niceties from examples/surface-viewer-demo.js

var atlas_labels = {};

// Request variables used to cancel the current request
Expand All @@ -46,7 +46,7 @@ angular.module("app").directive("brainbrowser", function() {
}

function hideLoading() {
scope.loading = false;
scope.loading = false;
}

// Make sure WebGL is available.
Expand Down Expand Up @@ -515,16 +515,21 @@ angular.module("app").directive("brainbrowser", function() {
viewer.clearScreen();
current_request = 0;
current_request_name = "";
loading_div.hide();
// loading_div.hide();
});

$("#brainbrowser").click(function(event) {
scope.element.addEventListener("click", function(event) {
if (!event.shiftKey && !event.ctrlKey) return;
if (viewer.model.children.length === 0) return;

var annotation_display = $("#annotation-display");
var media = $("#annotation-media");
var pick_info = viewer.pick();
//keep this click into the masks...
//
console.log("Adding a mouse pick ", pick_info);
scope.addPointToCurrentMouseMask(pick_info);

var model_data;
var annotation_info;
var value, label, text;
Expand Down
7 changes: 7 additions & 0 deletions client/partials/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
<input placeholder="script name to run on the data" ng-model="scriptName" type="text"/><button class="btn btn-primary" ng-click="runScript(scriptName)">Run</button>
</li>

<li class="breadcrumb">
Mouse mask:
<pre>
{{mouseMasks[mouseMasks.length -1] | json}}
</pre>
</li>

<li class="breadcrumb">
<table class="matrix">
<tbody>
Expand Down

0 comments on commit 7a8157d

Please sign in to comment.