Commit dbf1e272 authored by Aayush's avatar Aayush

ascii_art state derived at every input

parent 665861c1
Pipeline #1627 failed with stage
in 0 seconds
"use strict";
//to store indexes of characters
function INDEX(x, y){
this.x = x;
this.y = y;
};
function INDEX(x, y){
this.x = x;
this.y = y;
};
//for tracking connection path
function tracking_connection(curr_row, curr_col, next_row, next_col ,
......
......@@ -55,10 +55,11 @@
<textarea id="ascii_art_text_area"
rows="10" cols="50">write your ascii art here</textarea>
<br/>
<p id="ascii_art_state">State:partial</p>
<button type="button"
id="canvas_ascii_art_button"
data-i18n="[title]canvas.ascii_art.submit_tt">
<span data-i18n="canvas.ascii_art.submit"></span>
<span data-i18n="canvas.ascii_art.submit"></span>
</div>
<div style="display:none;" id="dropdown_list" class="noselect">
<ol></ol>
......
......@@ -427,15 +427,27 @@ var canvas_events = (function() {
events.find_click(evt);
}
},
check_ascii_art_state: function(evt) {
events.submit_ascii_art(evt);
},
submit_ascii_art : function(evt) {
var ascii_art = document.getElementById("ascii_art_text_area").value;
var parsed_art = pd_ascii_art.parse_ascii_art(ascii_art);
var ascii_art_state = document.getElementById("ascii_art_state");
var current_state = parsed_art.state;
// to check the create pd_message
//document.getElementById("ascii_art_text_area").innerHTML = parsed_art.pd_message;
canvas_events.normal();
pdgui.pdsend(name, "cut");
canvas_events.paste_from_pd_file(name, parsed_art.pd_message);
canvas_events.ascii_art();
if (current_state === "valid") {
canvas_events.normal();
ascii_art_state.innerHTML = "State:"+current_state
pdgui.pdsend(name, "cut");
canvas_events.paste_from_pd_file(name, parsed_art.pd_message);
canvas_events.ascii_art();
}
else {
ascii_art_state.innerHTML = "State:"+current_state;
}
},
scalar_draggable_mousemove: function(evt) {
var new_x = evt.pageX,
......@@ -784,7 +796,7 @@ var canvas_events = (function() {
ascii_art: function() {
set_edit_menu_modals(false);
canvas_events.none();
//document.addEventListener("keydown", events.find_keydown, false);
document.addEventListener("keyup", events.check_ascii_art_state, false);
state = "ascii_art";
},
register: function(n) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment