From 5c3fe78bd507f1ed346436d35a7174515635ac12 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Mon, 17 Aug 2015 12:51:33 -0700 Subject: [PATCH] [Mobile, Gestures] Pinch Moved MCTPinch directive into plot-reborn. Now emits on pinch action the event to the controller. Edited plot.html to clean up and edited mct-plot.html to include mct-pinch. DrawLoader adjusted to allow and prevent error. --- platform/features/plot-reborn/bundle.json | 5 +++++ .../plot-reborn/res/templates/mct-plot.html | 4 +++- .../features/plot-reborn/res/templates/plot.html | 2 +- .../plot-reborn/src/controllers/PlotController.js | 5 +++++ .../src/directives}/MCTPinch.js | 15 +++------------ .../features/plot-reborn/src/draw/DrawLoader.js | 2 +- platform/features/plot/bundle.json | 10 ---------- 7 files changed, 18 insertions(+), 25 deletions(-) rename platform/features/{plot/src => plot-reborn/src/directives}/MCTPinch.js (86%) diff --git a/platform/features/plot-reborn/bundle.json b/platform/features/plot-reborn/bundle.json index f8f6c6b7c2..f90d0c0e04 100644 --- a/platform/features/plot-reborn/bundle.json +++ b/platform/features/plot-reborn/bundle.json @@ -47,6 +47,11 @@ "key": "mctOverlayPlot", "implementation": "directives/MCTOverlayPlot.js", "depends": [] + }, + { + "key": "mctPinch", + "implementation": "directives/MCTPinch.js", + "depends": [ "$log", "agentService" ] } ], "controllers": [ diff --git a/platform/features/plot-reborn/res/templates/mct-plot.html b/platform/features/plot-reborn/res/templates/mct-plot.html index 0fdd6a7c3a..8e1128dfb7 100644 --- a/platform/features/plot-reborn/res/templates/mct-plot.html +++ b/platform/features/plot-reborn/res/templates/mct-plot.html @@ -47,13 +47,15 @@ + + ng-mouseup="plot.endMarquee()" + mct-pinch> diff --git a/platform/features/plot-reborn/res/templates/plot.html b/platform/features/plot-reborn/res/templates/plot.html index 5656adee31..1d19951a03 100644 --- a/platform/features/plot-reborn/res/templates/plot.html +++ b/platform/features/plot-reborn/res/templates/plot.html @@ -5,5 +5,5 @@ axes="axes" displayable-range="displayableRange" displayable-domain="displayableDomain"> - + diff --git a/platform/features/plot-reborn/src/controllers/PlotController.js b/platform/features/plot-reborn/src/controllers/PlotController.js index fe0b17f05d..7b8b779238 100644 --- a/platform/features/plot-reborn/src/controllers/PlotController.js +++ b/platform/features/plot-reborn/src/controllers/PlotController.js @@ -153,6 +153,10 @@ define( } }; } + + function onPinchAction(event) { + console.log("TEST"); + } function followDataIfLive() { if (isLive) { @@ -163,6 +167,7 @@ define( $scope.$on('series:data:add', followDataIfLive); $scope.$on('user:viewport:change:end', onUserViewportChangeEnd); $scope.$on('user:viewport:change:start', onUserViewportChangeStart); + $scope.$on('mct:pinch:action', onPinchAction); $scope.$watch('domainObject', linkDomainObject); diff --git a/platform/features/plot/src/MCTPinch.js b/platform/features/plot-reborn/src/directives/MCTPinch.js similarity index 86% rename from platform/features/plot/src/MCTPinch.js rename to platform/features/plot-reborn/src/directives/MCTPinch.js index 77ee68b1ea..1d5673c827 100644 --- a/platform/features/plot/src/MCTPinch.js +++ b/platform/features/plot-reborn/src/directives/MCTPinch.js @@ -28,7 +28,7 @@ define( function MCTPinch($log, agentService) { - function link(scope, element, attrs) { + function link($scope, element, attrs) { var posPrev, evePrev; @@ -44,13 +44,7 @@ define( touchPositionPrev = posPrev || touchPosition, eventPrev = evePrev || event; - scope.mctPinch({ - dimensions: touchPosition, - prevDimensions: touchPositionPrev, - event: event, - eventPrev: eventPrev - }); - + $scope.$emit('mct:pinch:action', event); // Set current position to be previous position // for next touch action posPrev = touchPosition; @@ -71,14 +65,11 @@ define( } // Stop checking for resize when scope is destroyed -// scope.$on("$destroy", destroyEverythingNow); +// $scope.$on("$destroy", destroyEverythingNow); } return { restrict: "A", - scope: { - mctPinch: "&" - }, // Link with the provided function link: link }; diff --git a/platform/features/plot-reborn/src/draw/DrawLoader.js b/platform/features/plot-reborn/src/draw/DrawLoader.js index 8389f67ca5..82ffe9c44e 100644 --- a/platform/features/plot-reborn/src/draw/DrawLoader.js +++ b/platform/features/plot-reborn/src/draw/DrawLoader.js @@ -5,7 +5,7 @@ define( './DrawWebGL', './Draw2D' ], - function (DrawWebGL, Draw2D) { + function ($log, DrawWebGL, Draw2D) { var CHARTS = [ DrawWebGL, diff --git a/platform/features/plot/bundle.json b/platform/features/plot/bundle.json index b80d7b311a..d367c028cb 100644 --- a/platform/features/plot/bundle.json +++ b/platform/features/plot/bundle.json @@ -17,16 +17,6 @@ "key": "mctChart", "implementation": "MCTChart.js", "depends": [ "$interval", "$log" ] - }, - { - "key": "mctPinch", - "implementation": "MCTPinch.js", - "depends": [ "$log", "agentService" ] - }, - { - "key": "mctPan", - "implementation": "MCTPan.js", - "depends": [ "$log", "agentService" ] } ], "controllers": [