(player, preview)
| 157 | } |
| 158 | |
| 159 | init(player, preview) { |
| 160 | this.player = player; |
| 161 | this.preview = preview; |
| 162 | this.canvas.width = this.player.width; |
| 163 | this.canvas.height = this.player.height; |
| 164 | this.title_div = this.preview.querySelector('.preview_title'); |
| 165 | |
| 166 | this.description = document.createElement('span'); |
| 167 | this.description.classList.toggle('description'); |
| 168 | this.description.addEventListener('click', (function(e) { |
| 169 | const new_text = prompt("enter new text"); |
| 170 | if (new_text) { |
| 171 | this.update_name(new_text); |
| 172 | } |
| 173 | }).bind(this)); |
| 174 | this.title_div.appendChild(this.description); |
| 175 | |
| 176 | let delete_option = document.createElement('a'); |
| 177 | delete_option.textContent = '[x]'; |
| 178 | delete_option.style.float = "right"; |
| 179 | delete_option.addEventListener('click', (function() { |
| 180 | if (confirm("delete layer \"" + this.name + "\"?")) { |
| 181 | this.player.remove(this); |
| 182 | } |
| 183 | }).bind(this)); |
| 184 | this.title_div.appendChild(delete_option); |
| 185 | |
| 186 | this.thumb_canvas = this.preview.querySelector('.preview_thumb'); |
| 187 | this.thumb_ctx = this.thumb_canvas.getContext('2d'); |
| 188 | this.thumb_ctx.scale(dpr, dpr); |
| 189 | this.update_name(this.name); |
| 190 | } |
| 191 | |
| 192 | render_time(ctx, y_coord, width, selected) { |
| 193 | let scale = ctx.canvas.clientWidth / this.player.total_time; |
nothing calls this directly
no test coverage detected