~ubuntu-branches/ubuntu/vivid/gnome-maps/vivid-proposed

« back to all changes in this revision

Viewing changes to src/searchResultMarker.js

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2014-09-22 23:04:28 UTC
  • mfrom: (1.1.3) (2.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20140922230428-zvgvmk5pea6eavcz
Tags: 3.14.0-1
* New upstream release.
* Drop debian/patches/gjs-readwrite-flags.patch, fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
 
2
/* vim: set et ts=4 sw=4: */
 
3
/*
 
4
 * Copyright (c) 2014 Damián Nohales
 
5
 *
 
6
 * GNOME Maps is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by the
 
8
 * Free Software Foundation; either version 2 of the License, or (at your
 
9
 * option) any later version.
 
10
 *
 
11
 * GNOME Maps is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
13
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
14
 * for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along
 
17
 * with GNOME Maps; if not, write to the Free Software Foundation,
 
18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 *
 
20
 * Author: Damián Nohales <damiannohales@gmail.com>
 
21
 */
 
22
 
 
23
const Lang = imports.lang;
 
24
 
 
25
const MapMarker = imports.mapMarker;
 
26
const Path = imports.path;
 
27
const SearchResultBubble = imports.searchResultBubble;
 
28
const Utils = imports.utils;
 
29
 
 
30
const SearchResultMarker = new Lang.Class({
 
31
    Name: 'SearchResultMarker',
 
32
    Extends: MapMarker.MapMarker,
 
33
 
 
34
    _init: function(params) {
 
35
        this.parent(params);
 
36
 
 
37
        this.add_actor(Utils.CreateActorFromIconName('maps-pin'));
 
38
    },
 
39
 
 
40
    get anchor() {
 
41
        return { x: Math.floor(this.width / 2),
 
42
                 y: this.height - 3 };
 
43
    },
 
44
 
 
45
    _createBubble: function() {
 
46
        if (this.place.name) {
 
47
            return new SearchResultBubble.SearchResultBubble({ place: this.place,
 
48
                                                               mapView: this._mapView });
 
49
        } else
 
50
            return null;
 
51
    }
 
52
});