~ubuntu-branches/ubuntu/trusty/gnome-shell/trusty-proposed

« back to all changes in this revision

Viewing changes to js/ui/flashspot.js

Tags: upstream-3.3.90
ImportĀ upstreamĀ versionĀ 3.3.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
2
 
 
3
const Lang = imports.lang;
 
4
 
 
5
const Lightbox = imports.ui.lightbox;
 
6
const Main = imports.ui.main;
 
7
const Tweener = imports.ui.tweener;
 
8
 
 
9
const FLASHSPOT_ANIMATION_TIME = 0.25; // seconds
 
10
 
 
11
const Flashspot = new Lang.Class({
 
12
    Name: 'Flashspot',
 
13
    Extends: Lightbox.Lightbox,
 
14
 
 
15
    _init: function(area) {
 
16
        this.parent(Main.uiGroup, { inhibitEvents: true,
 
17
                                    width: area.width,
 
18
                                    height: area.height });
 
19
 
 
20
        this.actor.style_class = 'flashspot';
 
21
        this.actor.set_position(area.x, area.y);
 
22
    },
 
23
 
 
24
    fire: function() {
 
25
        this.actor.opacity = 0;
 
26
        Tweener.addTween(this.actor,
 
27
                         { opacity: 255,
 
28
                           time: FLASHSPOT_ANIMATION_TIME,
 
29
                           transition: 'linear',
 
30
                           onComplete: Lang.bind(this, this._onFireShowComplete)
 
31
                         });
 
32
        this.actor.show();
 
33
    },
 
34
 
 
35
    _onFireShowComplete: function() {
 
36
        Tweener.addTween(this.actor,
 
37
                         { opacity: 0,
 
38
                           time: FLASHSPOT_ANIMATION_TIME,
 
39
                           transition: 'linear',
 
40
                           onComplete: Lang.bind(this, function() {
 
41
                               this.destroy();
 
42
                           })
 
43
                         });
 
44
    }
 
45
});