[gnome-maps/wip/accuracy-circle] tmp



commit c3b34fef6edf0a7c59a26370de40f5d9c21509c4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Apr 12 04:28:28 2013 +0300

    tmp

 src/mapView.js      |    2 +-
 src/userLocation.js |   36 +++++++++++++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 0a047d2..cf17810 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -66,7 +66,7 @@ const MapView = new Lang.Class({
         this.view.add_layer(this._markerLayer);
 
         this._userLocationLayer = new Champlain.MarkerLayer();
-        this._userLocationLayer.set_selection_mode(Champlain.SelectionMode.NONE);
+        this._userLocationLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
         this.view.add_layer(this._userLocationLayer);
 
         this._factory = Champlain.MapSourceFactory.dup_default();
diff --git a/src/userLocation.js b/src/userLocation.js
index fc89cb1..9819062 100644
--- a/src/userLocation.js
+++ b/src/userLocation.js
@@ -43,16 +43,46 @@ const UserLocation = new Lang.Class({
         layer.remove_all();
 
         let locationMarker = new Champlain.CustomMarker();
-        locationMarker.set_reactive(false);
         locationMarker.set_location(this.latitude, this.longitude);
         // FIXME: Using deprecated function here cause I failed to get the same result
         //        with locationMarker.set_pivot_point(0.5, 0).
         locationMarker.set_anchor_point_from_gravity(Clutter.Gravity.SOUTH);
-        let actor = Utils.CreateActorFromImageFile(Path.ICONS_DIR + "/pin.svg");
-        if (actor == null)
+        let pin_actor = Utils.CreateActorFromImageFile(Path.ICONS_DIR + "/pin.svg");
+        if (pin_actor == null)
             return;
+        let bubble_actor = Utils.CreateActorFromImageFile("/home/zeenix/bubble.svg");
+        if (bubble_actor == null)
+            return;
+        //bubble_actor.set_x_align (Clutter.Align.FILL);
+        bubble_actor.set_x_expand(true);
+        bubble_actor.set_y_expand(true);
+        let text_actor = new Clutter.Text({ text: this.description });
+        text_actor.set_margin_left(6);
+        text_actor.set_margin_right(6);
+        text_actor.set_color(new Clutter.Color({ red: 255,
+                                                 blue: 255,
+                                                 green: 255,
+                                                 alpha: 255 }));
+        let layout = new Clutter.BinLayout();
+        let description_actor = new Clutter.Actor({ layout_manager: layout });
+        description_actor.add_child(bubble_actor);
+        description_actor.add_child(text_actor);
+
+        let layout = new Clutter.BoxLayout({ vertical: true });
+        let actor = new Clutter.Actor({ layout_manager: layout });
+        actor.add_child(pin_actor);
+
         locationMarker.add_actor(actor);
 
+        locationMarker.connect("notify::selected", Lang.bind(this,
+            function() {
+                if (locationMarker.get_selected()) {
+                    if (description_actor.get_parent() == null)
+                        actor.insert_child_at_index(description_actor, 0);
+                } else
+                    actor.remove_child(description_actor);
+            }));
+
         if (this.accuracy == 0) {
             layer.add_marker(locationMarker);
             return;


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