summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/blueprint/BlueprintNotice.js
blob: 4b799a64cabba9e3e9ff622c26e37a949ce9972c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var BlueprintNotice = View.extend(ToggleableView.prototype).extend({
  
  el: "#blueprintNotice",
  
  events: {
    "click .next": "next",
  },
  
  initialize: function(opt){
    this.parent = opt.parent
    this.$notice = this.$(".notice")
    this.$next = this.$(".next")
  },
  
  notice: function(msg){
    this.$notice.html(msg)
  },
  
  showCreateProjectNotice: function(){
    this.notice("<a href='/project/blueprint/" + this.parent.data.slug +
                "'>Start a new project</a> with this blueprint.")
    this.$next.hide()
    this.nextFn = null
    this.show()
  },
  
  showStartPositionNotice: function(){
    this.parent.settings.hide()
    this.notice("First, click the map to set the starting location.")
    this.$next.show().html("Next")
    this.show()
    this.nextFn = this.showStartAngleNotice.bind(this)
  },
  
  showStartAngleNotice: function(){
    this.parent.settings.hide()
    this.notice("Next, rotate the camera to the desired orientation.")
    this.$next.show().html("Done")
    this.show()
    this.nextFn = this.doneSettingPosition.bind(this)
    this.parent.toolbar.toggleOrbitMode(false)
  },
  
  doneSettingPosition: function(){
    this.nextFn = null
    this.$next.hide()
    this.hide()
    this.parent.settings.show()
    this.parent.startPosition.rotationX = cam.rotationX
    this.parent.startPosition.rotationY = cam.rotationY
    this.parent.toolbar.toggleOrbitMode(true)
    this.parent.toolbar.orthoPolylineMode()
  },
  
  nextFn: null,
  next: function(){
    if (this.nextFn) {
      this.nextFn()
    }
  },

})