From 35bc17e3e7ce869a2a964dfad03b233bf30134ee Mon Sep 17 00:00:00 2001 From: Kurt Nelson Date: Sun, 16 Mar 2014 18:41:12 -0400 Subject: [PATCH 1/3] Use WearScript GH org --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index c4df61d..195f8e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "server"] path = server - url = https://github.com/OpenShades/wearscript-server + url = git@github.com:wearscript/wearscript-server.git From de31ace869b9bf8d3ecf29d7398ea9640508e1f7 Mon Sep 17 00:00:00 2001 From: "Brandyn A. White" Date: Sat, 22 Mar 2014 17:05:36 +0000 Subject: [PATCH 2/3] Updated annotation tab Signed-off-by: Brandyn A. White --- app/scripts/controllers/annotation.js | 31 +++++++++++++++++++-------- app/views/annotation.html | 2 +- server | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/scripts/controllers/annotation.js b/app/scripts/controllers/annotation.js index 3d33c4b..0e2fff9 100644 --- a/app/scripts/controllers/annotation.js +++ b/app/scripts/controllers/annotation.js @@ -6,10 +6,11 @@ angular.module('wearscriptPlaygroundApp') $scope.images = {}; // [device] = imageb64 this.canvas = document.querySelector('#canvas'); this.context = this.canvas.getContext('2d'); - + this.pointCount = -1; + this.points = []; + this.response = ''; this.initCanvas = function () { - this.context.fillStyle = '#FFFFFF'; // set canvas background color - this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); // now fill the canvas + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); var tool = {}; function ev_canvas (ev) { @@ -44,6 +45,15 @@ angular.module('wearscriptPlaygroundApp') }; tool.mousedown = function (ev) { + if (this.pointCount > 0) { + this.points.push([ev._x, ev._y]); + if (this.points.length == this.pointCount) { + this.pointCount = -1; + ws.publish(this.response, this.points); + this.points = []; + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + } + } this.context.beginPath(); this.context.arc(ev._x, ev._y, 50, 0, 2 * Math.PI); this.context.strokeStyle = '#0b61a4'; @@ -65,21 +75,24 @@ angular.module('wearscriptPlaygroundApp') } this.initCanvas(); - - this.image_cb = function (channel, time, imageData, numPoints, description) { - var image = new Image(); + this.image_cb = function (channel, response, imageData, numPoints, description) { + this.pointCount = numPoints; + this.points = []; + this.response = response; + var image = new Image(); + console.log(channel); image.onload = function (image_id) { this.context.drawImage(image, 0, 0); + console.log('Height: ' + image.naturalHeight + ' Width: ' + image.naturalWidth); }.bind(this); - image.src = 'data:image/jpeg;base64,' + btoa(imageData); + image.src = 'data:image/jpeg;base64,' + imageData; console.log(image.src.length); document.querySelector('#canvas') - $scope.numPoints = numPoints; $scope.description = description; $scope.$apply(); // HACK(brandyn): Not sure why we have to do this }.bind(this); - ws.subscribe('image', this.image_cb); + ws.subscribe('annotationimagepoints', this.image_cb); $scope.$on('$destroy', function cleanup() { ws.unsubscribe('image'); }); diff --git a/app/views/annotation.html b/app/views/annotation.html index 84257f6..997cf65 100644 --- a/app/views/annotation.html +++ b/app/views/annotation.html @@ -1 +1 @@ - + diff --git a/server b/server index 54fd4c8..df98b21 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 54fd4c8c51706fe9608c8cedf5b6bbfa31a82f5b +Subproject commit df98b21eca5b2618752bebbea73b5b864e82f4ca From f84acec15d47194807cd41cee995a0abce15e864 Mon Sep 17 00:00:00 2001 From: "G. Hussain Chinoy" Date: Mon, 24 Mar 2014 21:15:59 -0600 Subject: [PATCH 3/3] Update README.md Simple modification of README to replace OpenShades github references with wearscript --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 872ff65..6edda9a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Wearscript Playground # - + ## About ## The web-based IDE for WearScript. Write code, pair glass, save, and enjoy. @@ -18,7 +18,7 @@ The web-based IDE for WearScript. Write code, pair glass, save, and enjoy. 1. Clone repo and submodules ```bash - git clone git@github.com:OpenShades/wearscript-playground.git + git clone git@github.com:wearscript/wearscript-playground.git cd wearscript-playground git submodule update --init ```