[gnome-maps/wip/drag-n-drop: 3/4] routeQuery: Add getIndex method



commit 27354e8783d573adf28c0a988be426bfabb3301d
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Nov 27 07:17:59 2014 -0500

    routeQuery: Add getIndex method

 src/routeQuery.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/routeQuery.js b/src/routeQuery.js
index 554d68b..5eac0c6 100644
--- a/src/routeQuery.js
+++ b/src/routeQuery.js
@@ -111,6 +111,16 @@ const RouteQuery = new Lang.Class({
         }
     },
 
+    getIndex: function(point) {
+        for (let i = 0; i < this._points.length; i++) {
+            if (this._points[i] === point) {
+                return i;
+            }
+        }
+
+        return -1;
+    },
+
     set transportation(transportation) {
         this._transportation = transportation;
         this.notify('transportation');


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]