1 |
|
---|
2 | var playNoteOverlayMode = "paused";
|
---|
3 |
|
---|
4 | PhotoNote.prototype.Play = function()
|
---|
5 | {
|
---|
6 | //console.log("*** Activate Play for this note!!");
|
---|
7 | // console.log("*** this.rect" + this.rect);
|
---|
8 |
|
---|
9 | var mysong = document.getElementById("mysong");
|
---|
10 | var barWidth = mysong.getElementWidth();
|
---|
11 |
|
---|
12 | //var mevent = new Event();
|
---|
13 | //var mevent = document.createEvent("MouseEvent");
|
---|
14 | // mevt.initMouseEvent("click",true,true,...);
|
---|
15 |
|
---|
16 | //var selfSimImg = document.getElementById("selfSimImgId");
|
---|
17 | //var imgWidth = selfSimImg.getAttribute("width");
|
---|
18 | //var imgHeight = selfSimImg.getAttribute("height") * yScaleSimImg;
|
---|
19 |
|
---|
20 | var img_x = $("#selfSimImgId").offset().left;
|
---|
21 | var img_y = $("#selfSimImgId").offset().top;
|
---|
22 |
|
---|
23 |
|
---|
24 | var mevent = new Object();
|
---|
25 | mevent.pageX = img_x + this.rect.left;
|
---|
26 | mevent.pageY = img_y + this.rect.top;
|
---|
27 |
|
---|
28 | console.log("*** toggle play mode = " + togglePlayMode);
|
---|
29 | console.log("*** playTrackerMode = " + playTrackerMode);
|
---|
30 |
|
---|
31 | /*
|
---|
32 | if (togglePlayMode.match("pause")) {
|
---|
33 | // (counter-intuitively) means it is playing
|
---|
34 | if (playTrackerMode.match("playing")) {
|
---|
35 | // in dualPlay() mode
|
---|
36 | togglePlay(mevent,this);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | else {
|
---|
40 | //
|
---|
41 | dualPlay(mevent);
|
---|
42 | }
|
---|
43 | */
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | if (playNoteOverlayMode == "paused") {
|
---|
48 | playNoteOverlayMode = "playing";
|
---|
49 | dualPlay(mevent);
|
---|
50 | }
|
---|
51 | else {
|
---|
52 | playNoteOverlayMode = "paused";
|
---|
53 | togglePlay(mevent,this);
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 | // code for cancel =>
|
---|
59 | //this.oldRect = null;
|
---|
60 | //this.gui.TextTitle.innerHTML = this.gui.TextBox.value;
|
---|
61 | //this.text = this.gui.TextBox.value
|
---|
62 | //this.UnSelect();
|
---|
63 | }
|
---|
64 |
|
---|
65 | PhotoNote.prototype.appendPlayElement = function()
|
---|
66 | {
|
---|
67 | var currentNote = this;
|
---|
68 |
|
---|
69 | var newButtonPlay = document.createElement('a');
|
---|
70 | newButtonPlay.setAttribute("class", "annotator-save annotator-inline");
|
---|
71 | newButtonPlay.innerHTML='Play';
|
---|
72 | newButtonPlay.onmouseover = function(){_zoomEnabled = false;};
|
---|
73 | newButtonPlay.onmouseout = function(){_zoomEnabled = true;};
|
---|
74 | newButtonPlay.onclick = function() {
|
---|
75 | currentNote.Play();
|
---|
76 | };
|
---|
77 |
|
---|
78 | this.buttonsDiv.appendChild(newButtonPlay);
|
---|
79 | }
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 | OverlayNotes.prototype.getNotes = function(divID,metaname)
|
---|
84 | {
|
---|
85 | if(gs.variables[metaname] == null || gs.variables[metaname] == undefined)
|
---|
86 | {
|
---|
87 | console.log("No photo notes");
|
---|
88 | return;
|
---|
89 | }
|
---|
90 |
|
---|
91 | for(var i = 0; i < gs.variables[metaname].length; i++)
|
---|
92 | {
|
---|
93 | var metavals = gs.variables[metaname];
|
---|
94 | var note = metavals[i];
|
---|
95 | if(!note)
|
---|
96 | {
|
---|
97 | continue;
|
---|
98 | }
|
---|
99 |
|
---|
100 | var newNote = new PhotoNote(note.caption, divID, i+1, new PhotoNoteRect(note.area.x,note.area.y,note.area.width,note.area.height));
|
---|
101 | newNote.appendPlayElement();
|
---|
102 |
|
---|
103 | var that = this;
|
---|
104 | newNote.onsave = function(note) { return that.saveFunction(note) };
|
---|
105 | newNote.ondelete = function(note) { return that.deleteFunction(note) };
|
---|
106 |
|
---|
107 | this.notes.AddNote(newNote);
|
---|
108 | this.posCount++;
|
---|
109 | }
|
---|
110 |
|
---|
111 | this.addNoteOverAndOutHandlers();
|
---|
112 | }
|
---|
113 |
|
---|
114 | OverlayNotes.prototype.AddNote = function()
|
---|
115 | {
|
---|
116 | this.posCount++;
|
---|
117 |
|
---|
118 | var photoPos = $("#"+this.divID).offset();
|
---|
119 |
|
---|
120 | var newNote = new PhotoNote('Add note text here...',this.divID,this.posCount,new PhotoNoteRect(20,20,50,50));
|
---|
121 | newNote.appendPlayElement();
|
---|
122 |
|
---|
123 | var that = this;
|
---|
124 | newNote.onsave = function(note) { return that.saveFunction(note) };
|
---|
125 | newNote.ondelete = function(note) { return that.deleteFunction(note) };
|
---|
126 | this.notes.AddNote(newNote);
|
---|
127 |
|
---|
128 | this.addNoteOverAndOutHandlers();
|
---|
129 | newNote.Select();
|
---|
130 | }
|
---|
131 |
|
---|