From fcb594dc4b60ef304bfe29c5907cccb07e456848 Mon Sep 17 00:00:00 2001 From: Fry Date: Mon, 12 Feb 2018 22:32:49 -0500 Subject: [PATCH] release --- ...\2018\\Matlab\\DDE_Data\\Input_Time_Curve" | 4 + ...18\\Matlab\\DDE_Data\\Spline_Input_Points" | 4 + ...8\\Matlab\\DDE_Data\\Spline_Output_Points" | 90 ++++++ ..._apps\\2018\\Matlab\\DDE_Data\\Time_Curve" | 90 ++++++ blocksde/blocks2.js | 306 +++++++----------- blocksde/jsdb_newObject.js | 115 ++++--- blocksde/style2.css | 122 ++++--- blocksde/workspace.js | 9 +- doc/guide.html | 4 +- doc/release_notes.html | 27 ++ html_db.js | 19 ++ index.html | 6 +- package.json | 4 +- 13 files changed, 508 insertions(+), 292 deletions(-) create mode 100644 "C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Input_Time_Curve" create mode 100644 "C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Input_Points" create mode 100644 "C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Output_Points" create mode 100644 "C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Time_Curve" diff --git "a/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Input_Time_Curve" "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Input_Time_Curve" new file mode 100644 index 00000000..1caab432 --- /dev/null +++ "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Input_Time_Curve" @@ -0,0 +1,4 @@ +0,0,0 +3.3333333333333335,0.3185576949569766,0 +6.666666666666667,0.6229616892347773,0 +10,0.8129434037098955,0 \ No newline at end of file diff --git "a/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Input_Points" "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Input_Points" new file mode 100644 index 00000000..4b00fb72 --- /dev/null +++ "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Input_Points" @@ -0,0 +1,4 @@ +-0.2,0.45,0.075 +0,0.45,0.3 +0.2,0.45,0.075 +0.3,0.45,0.2 \ No newline at end of file diff --git "a/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Output_Points" "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Output_Points" new file mode 100644 index 00000000..3ecb473f --- /dev/null +++ "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Spline_Output_Points" @@ -0,0 +1,90 @@ +-0.19355530864197532,0.45,0.08727246913580247 +-0.18710913580246916,0.45,0.09951308641975308 +-0.18066000000000002,0.45,0.11169 +-0.17420641975308643,0.45,0.12377135802469136 +-0.1677469135802469,0.45,0.1357253086419753 +-0.16128,0.45,0.14751999999999998 +-0.15480419753086422,0.45,0.15912358024691356 +-0.14831802469135802,0.45,0.1705041975308642 +-0.14182,0.45,0.18162999999999999 +-0.13530864197530865,0.45,0.1924691358024691 +-0.12878246913580246,0.45,0.20298975308641976 +-0.12224,0.45,0.21315999999999996 +-0.11567975308641974,0.45,0.222948024691358 +-0.10910024691358025,0.45,0.23232197530864196 +-0.10250000000000001,0.45,0.24124999999999996 +-0.09587753086419752,0.45,0.24970024691358023 +-0.08923135802469134,0.45,0.25764086419753085 +-0.08256,0.45,0.26504 +-0.07586197530864197,0.45,0.2718658024691358 +-0.06913580246913578,0.45,0.2780864197530864 +-0.06237999999999999,0.45,0.28367 +-0.05559308641975308,0.45,0.28858469135802467 +-0.048773580246913556,0.45,0.2927986419753086 +-0.041919999999999985,0.45,0.29627999999999993 +-0.03503086419753082,0.45,0.2989969135802469 +-0.028104691358024653,0.45,0.3009175308641975 +-0.021139999999999992,0.45,0.30200999999999995 +-0.014135308641975292,0.45,0.30224246913580244 +-0.007089135802469115,0.45,0.30158308641975307 +2.7755575615628914e-17,0.45,0.3 +0.0071320987654320996,0.45,0.29747654320987654 +0.014301234567901236,0.45,0.29405679012345676 +0.021500000000000005,0.45,0.2898 +0.02872098765432099,0.45,0.2847654320987654 +0.035956790123456796,0.45,0.27901234567901234 +0.0432,0.45,0.2726 +0.05044320987654321,0.45,0.26558765432098763 +0.05767901234567902,0.45,0.2580345679012346 +0.06490000000000001,0.45,0.25 +0.07209876543209877,0.45,0.2415432098765432 +0.07926790123456791,0.45,0.23272345679012346 +0.0864,0.45,0.22360000000000002 +0.09348765432098767,0.45,0.21423209876543212 +0.10052345679012346,0.45,0.20467901234567903 +0.10750000000000001,0.45,0.195 +0.1144098765432099,0.45,0.18525432098765435 +0.1212456790123457,0.45,0.1755012345679013 +0.12800000000000003,0.45,0.1658 +0.13466543209876547,0.45,0.1562098765432099 +0.1412345679012346,0.45,0.14679012345679018 +0.14770000000000005,0.45,0.13760000000000006 +0.15405432098765437,0.45,0.12869876543209885 +0.16029012345679017,0.45,0.12014567901234571 +0.16640000000000005,0.45,0.11200000000000007 +0.1723765432098766,0.45,0.10432098765432102 +0.1782123456790124,0.45,0.09716790123456798 +0.18390000000000006,0.45,0.0906000000000001 +0.18943209876543216,0.45,0.08467654320987661 +0.1948012345679013,0.45,0.07945679012345688 +0.20000000000000004,0.45,0.0750000000000001 +0.2050232098765432,0.45,0.07135098765432099 +0.20987456790123457,0.45,0.06849679012345679 +0.21456,0.45,0.06641 +0.21908543209876544,0.45,0.06506320987654321 +0.2234567901234568,0.45,0.06442901234567902 +0.22768,0.45,0.06448000000000001 +0.231760987654321,0.45,0.06518876543209878 +0.23570567901234568,0.45,0.06652790123456792 +0.23951999999999998,0.45,0.06847000000000002 +0.24320987654320986,0.45,0.07098765432098766 +0.24678123456790121,0.45,0.07405345679012347 +0.25023999999999996,0.45,0.07764000000000001 +0.2535920987654321,0.45,0.08171987654320989 +0.25684345679012344,0.45,0.0862656790123457 +0.25999999999999995,0.45,0.09125000000000003 +0.2630676543209876,0.45,0.09664543209876547 +0.2660523456790123,0.45,0.10242456790123461 +0.26896,0.45,0.10856000000000006 +0.27179654320987645,0.45,0.11502432098765436 +0.27456790123456787,0.45,0.12179012345679016 +0.2772799999999999,0.45,0.12883000000000006 +0.2799387654320987,0.45,0.1361165432098766 +0.28255012345679004,0.45,0.14362234567901244 +0.28511999999999993,0.45,0.15132000000000007 +0.2876543209876542,0.45,0.1591820987654322 +0.2901590123456789,0.45,0.1671812345679013 +0.2926399999999999,0.45,0.17529000000000008 +0.2951032098765431,0.45,0.18348098765432114 +0.29755456790123447,0.45,0.1917267901234569 +0.2999999999999998,0.45,0.20000000000000012 \ No newline at end of file diff --git "a/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Time_Curve" "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Time_Curve" new file mode 100644 index 00000000..d9cf4eb3 --- /dev/null +++ "b/C:\\Users\\James\\OneDrive\\Documents\\dde_apps\\2018\\Matlab\\DDE_Data\\Time_Curve" @@ -0,0 +1,90 @@ +0.5456619199545218,0.013861729523743512,0 +0.7843043336076045,0.027695957213388397,0 +0.9729438822497347,0.041475237925366476,0 +1.1357799009815714,0.05517224160223419,0 +1.282095648306394,0.06875981516624535,0 +1.416590803535704,0.08221104988598182,0 +1.5420095936292055,0.09549935648109875,0 +1.6601003573939097,0.10859855064973768,0 +1.7720429564807638,0.12148295228395128,0 +1.8786655762581677,0.13412750242502314,0 +1.9805654649777704,0.1465079030633898,0 +2.0781812127463746,0.15860078628767155,0 +2.171838711630388,0.17038392113905018,0 +2.261782048394325,0.18183646896273167,0 +2.348195492446436,0.19293930122345343,0 +2.431220199460234,0.20367539783046704,0 +2.510967920201551,0.2140303491226154,0 +2.58753328903913,0.22399299076612514,0 +2.661005881092596,0.2335562074903086,0 +2.73148301859309,0.24271794752483783,0 +2.7990841770832096,0.25148249174434545,0 +2.8639677006527458,0.2598620136334739,0 +2.9263502702599817,0.2678784370408485,0 +2.9865290282200587,0.2755655311535134,0 +3.04490527524363,0.2829710568949711,0 +3.1020071580059683,0.2901585906134397,0 +3.158507072916018,0.2972084427058757,0 +3.215228657307092,0.304216990552633,0 +3.2731398326583228,0.31129394874456967,0 +3.333333333333336,0.3185576949569766,0 +3.396930473942935,0.32612305462929214,0 +3.4647340707955196,0.3340660527613782,0 +3.5372926070274766,0.34242921519562153,0 +3.6149899572212925,0.351232029328386,0 +3.6980790735541653,0.36047620807641434,0 +3.786708537724526,0.3701500008394831,0 +3.88094124788871,0.3802315226113991,0 +3.9807661020089986,0.3906912526192248,0 +4.0861039564921064,0.4014938885967724,0 +4.196809099819392,0.4125997214308545,0 +4.312667339545108,0.42396565969655237,0 +4.433391701462305,0.4355460006501309,0 +4.558616724206389,0.44729301802963767,0 +4.687892395508118,0.4591574175731446,0 +4.820678884945572,0.47108869726758984,0 +4.956343328955111,0.4830354396375448,0 +5.094159947807838,0.4949455567699753,0 +5.233314647297911,0.5067665044538842,0 +5.372914922492429,0.518445479279601,0 +5.512005324534565,0.5299296115237192,0 +5.649588032296957,0.5411661671069391,0 +5.784647324260554,0.5521027740783422,0 +5.916176160837434,0.5626876935271545,0 +6.043202850904063,0.5728701626749317,0 +6.164816014020205,0.582600851208875,0 +6.280186791522359,0.5918324943880293,0 +6.388588460495219,0.6005208048280452,0 +6.489415224867276,0.608625831484075,0 +6.582204084933417,0.6161140516697096,0 +6.66666666666667,0.6229616892347773,0 +6.742893188147713,0.6291703870501585,0 +6.811768211258707,0.63479907412877,0 +6.874402742011191,0.6399282033893267,0 +6.9320005028622615,0.6446497899147625,0 +6.985869707316046,0.6490669131288225,0 +7.0373964925857635,0.6532904307862054,0 +7.087976444524971,0.6574325086068721,0 +7.138921355289442,0.6615983068025999,0 +7.191375447497499,0.6658785862574431,0 +7.2462698313677185,0.6703455507954844,0 +7.304320638674473,0.6750523270723311,0 +7.366057298383007,0.6800349318640633,0 +7.431863551542981,0.6853152688553021,0 +7.502019307591458,0.6909041550675207,0 +7.576738062814386,0.6968039195326319,0 +7.656198925589762,0.7030104637051535,0 +7.740574404468531,0.7095148309400233,0 +7.830056007525605,0.7163043803130612,0 +7.924880196235611,0.7233636595406399,0 +8.025357881793473,0.7306750553275184,0 +8.131911920082976,0.7382192810304713,0 +8.245129652113338,0.7459757457904197,0 +8.365842900484672,0.7539228371727309,0 +8.495259469223653,0.762038140462982,0 +8.635197536551106,0.7702986113857487,0 +8.78854634246219,0.7786807144861232,0 +8.960299333620144,0.7871605362161889,0 +9.16038294890708,0.7957138795186139,0 +9.414777244979437,0.8043163451259397,0 +9.999999999999996,0.8129434037098955,0 \ No newline at end of file diff --git a/blocksde/blocks2.js b/blocksde/blocks2.js index 5b9a39c5..c28e904d 100644 --- a/blocksde/blocks2.js +++ b/blocksde/blocks2.js @@ -16,135 +16,6 @@ function dom_elt_block_type(elt){ return value_of_path(bt_string) } -function toggle_expand_collapse(event){ - debugger - event.stopPropagation() - let block_elt = event.target.parentNode.parentNode - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - if (is_block_collapsed(block_elt)) { - block_args_elt.classList.remove("block_args_collapsed") - if (is_block_horizontal(block_elt)) { block_args_elt.classList.add("block_args_horiz") } - else { block_args_elt.classList.add("block_args_vert") } - } - else { - block_args_elt.classList.remove("block_args_horiz") - block_args_elt.classList.remove("block_args_vert") - block_args_elt.classList.add("block_args_collapsed") - } - //if(block_args_elt.style.display == "none") { block_args_elt.style.display = "inline" } - //else { block_args_elt.style.display = "none" } -} - -function is_block_collapsed(block_elt){ - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - return block_args_elt.classList.contains("block_args_collapsed") //(block_args_elt.style.display == "none") -} - -//even if a block is collapsed, its args are still either configured for horiz or vert. -//(if no args, just call it "horiz". -function is_block_horizontal(block_elt){ - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - if(block_args_elt.classList.contains("block_args_horiz")) { return true } - else if(block_args_elt.classList.contains("block_args_vert")) { return false } - else { //its collapsed, and should have "block_args_collapsed" class - let first_name_val_arg = block_args_elt.firstChild - if (first_name_val_arg) { return first_name_val_arg.classList.contains("arg_name_val_horiz") } - else { //no args so default to horiz - return true - } - } - //let arg_name_val_elt = dom_elt_child_of_class(block_args_elt, "arg_name_val") - //if (!arg_name_val_elt) { return true } //since "horiz" is the default, just assume its true. - //else return arg_name_val_elt.style.display == "inline" //its "block" if its vertical. -} - -/*function toggle_horiz_vert(event){ - event.stopPropagation() - debugger - let block_elt = event.target.parentNode.parentNode - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - if(block_args_elt.style.display == "none") { //block is collapsed - block_args_elt.style.display = "inline" //expand block into horiz - } //might as well expand it - if(block_args_elt.style.display == "inline"){ //now horiz, change to vert - block_args_elt.style.display = "block" - for(let arg_name_val_elt of block_args_elt.children){ - if(arg_name_val_elt.classList.contains("arg_name_val")) { //filter out commas - arg_name_val_elt.style.display = "block" - arg_name_val_elt.style.marginLeft = "10px" - arg_name_val_elt.style.marginRight = "0px" - - let arg_name_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_name") - arg_name_elt.style.display = "inline" - } - } - } - else {//now vert, change to horiz - block_args_elt.style.display = "inline" - block_args_elt.style.marginLeft = "0px" - block_args_elt.style.marginRight = "10px" - for(let arg_name_val_elt of block_args_elt.children){ - if(arg_name_val_elt.classList.contains("arg_name_val")) { //filter out commas - arg_name_val_elt.style.display = "inline" - arg_name_val_elt.style.marginLeft = "0px" - arg_name_val_elt.style.marginRight = "0px" - let arg_name_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_name") - arg_name_elt.style.display = "none" //hide the names in horiz view - let arg_val_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_val") - arg_val_elt.style.marginLeft = "0px" - arg_val_elt.style.marginRight = "0px" - } - } - } -}*/ - -function toggle_horiz_vert(event){ - event.stopPropagation() - debugger - let block_elt = event.target.parentNode.parentNode - if(is_block_horizontal(block_elt)){ //now horiz, change to vert - make_block_vert(block_elt) - } - else {//now vert, change to horiz - make_block_horiz(block_elt) - } -} - -function make_block_horiz(block_elt){ - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - block_args_elt.classList.remove("block_args_collapsed") - block_args_elt.classList.remove("block_args_vert") - block_args_elt.classList.add("block_args_horiz") - for(let arg_name_val_elt of block_args_elt.children){ - if(arg_name_val_elt.classList.contains("arg_name_val")) { //filter out commas - arg_name_val_elt.classList.remove("arg_name_val_vert") - arg_name_val_elt.classList.add("arg_name_val_horiz") - - let arg_name_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_name") - arg_name_elt.style.display = "none" //hide the names in horiz view - //do I really need the below? - let arg_val_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_val") - arg_val_elt.style.marginLeft = "0px" - arg_val_elt.style.marginRight = "0px" - } - } -} - -function make_block_vert(block_elt){ - let block_args_elt = dom_elt_child_of_class(block_elt, "block_args") - block_args_elt.classList.remove("block_args_collapsed") - block_args_elt.classList.remove("block_args_horiz") - block_args_elt.classList.add("block_args_vert") - for(let arg_name_val_elt of block_args_elt.children){ - if(arg_name_val_elt.classList.contains("arg_name_val")) { //filter out commas - arg_name_val_elt.classList.remove("arg_name_val_horiz") - arg_name_val_elt.classList.add("arg_name_val_vert") - - let arg_name_elt = dom_elt_child_of_class(arg_name_val_elt, "arg_name") - arg_name_elt.style.display = "inline" - } - } -} //only 1 block can be selected function selected_block(){ @@ -157,11 +28,11 @@ function unselect_block(){ } function select_block(event){ + //debugger; event.stopPropagation() - let elt = event.target + let elt = first_ancestor_of_class(event.target, "block") //event.target might be a block_name for instance if (elt.classList.contains("block")) { - let prev_sel_block = selected_block() - if (prev_sel_block) { prev_sel_block.classList.remove("selected_block") } + unselect_block() elt.classList.add("selected_block") } else {} //don't select things that aren't blocks. maybe a param got passed or something @@ -172,6 +43,108 @@ function block_to_js(elt){ let src = bt.to_js(elt) return src } +//______resizer_______ +var drag_start_client_x +var drag_start_client_x +var old_client_x +var old_client_y +//var resizes= [] //just for testing of resizer_drag_handler + +function resizer_dragstart_handler(event){ + event.stopPropagation() + drag_start_client_x = event.clientX + drag_start_client_x = event.clientY + old_client_x = event.clientX + old_client_y = event.clientY + //debugger +} + +function ancestors_of_class_block_or_block_always_relative(elt){ + let result = [] + while(true) { + if (elt == null) { break } + else if(elt.classList && + (elt.classList.contains("block") || + elt.classList.contains("block_always_relative"))) { + result.push(elt) + } + elt = elt.parentNode + } + return result +} + +function resizer_drag_handler(event){ + //debugger + event.stopPropagation() + event.preventDefault() + if (event.buttons == 0) { //user has let up on the mouse so no longer dragging. + //sue to a chrome bug resizer_drag_handler will still be called a few times + //after user lets up on the mouse. + //the biggest problem is that the values I compute for the new width and height + //are wrong when the mouse is u. (not serue quite why but + //apparently due to bl.clientWidth being wrong or something. + //in any case, stop attempting to resize the block when the mouse + //is up to avoid setting to the wrong bl.style.width and height + return + } + let deltax = event.clientX - old_client_x + let deltay = event.clientY - old_client_y + old_client_x = event.clientX + old_client_y = event.clientY + let resizer_elt = event.target + let always_rel_elt = first_ancestor_of_class(resizer_elt, "block_always_relative") + let elts_to_resize = ancestors_of_class_block_or_block_always_relative(always_rel_elt) //will include the immediate + // parent of block_always_relative and its par, a block_elt + //as well as all similar classes block ancestors + resizes = [] + let resizes_internal = [] + for (bl of elts_to_resize){ + let wid = (bl.clientWidth + deltax) + "px" + let hei = (bl.clientHeight + deltay) + "px" + //if(bl.style.width != "") { debugger } + bl.style.width = wid + bl.style.height = hei + //resizes_internal.push([bl, bl.style.width, bl.style.height, event.buttons]) + } + //resizes.push(resizes_internal) + //} +} +function resizer_drop_handler(event){ + event.stopPropagation() + event.preventDefault() + let dropped_on_elt = event.target +} +function resizer_dragend_handler(event){ + event.stopPropagation() + event.preventDefault() + let resizer_elt = event.target + let block_elt = resizer_elt.parentNode +} + + +//this only resizes the block in question, not its container and on out. +//if it did resize container and on out, *maybe* that would be a good thing +//or maybe resize on in, or maybe both. +function resizer_onclick(event){ + debugger + event.stopPropagation() //we don't want this misinterpreted as a select of the block + let resi = event.target + let always_rel = first_ancestor_of_class(resi, "block_always_relative") + always_rel.style.width = "auto" + always_rel.style.height = "auto" + let block_elt = first_ancestor_of_class(resi, "block") + block_elt.style.width = "auto" + block_elt.style.height = "auto" +} + +function unfold_all_blocks(){ + let blks = document.querySelectorAll(".block") + for(let blk of blks){ + blk.style.width = "auto" + blk.style.height = "auto" + } +} +//_______End resizer_______ function install_block_drop_zones(block_that_is_being_dragged){ for(let a_class of [".top-left-spacer", ".bottom-left-spacer", @@ -196,7 +169,14 @@ function uninstall_block_drop_zones(){ //see https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API //http://apress.jensimmons.com/v5/pro-html5-programming/ch9.html more conceptual function block_dragstart_handler(event){ - let elt = event.target //the dom elt being dragged + + let elt = event.target //the dom elt being dragged, this will be a block + if(elt.style.position == "static") { + elt.style.position == "absolute" + elt.style.left = "auto" + elt.style.top = "auto" + } + out("starting to drag: " + elt.classList) //event.effectAllowed = "move" doesn't seem to help event.dataTransfer.setData("text", elt.id); //event.dropEffect = "move"; //changes cursor into 4 arrows which makes it hard to click on the tiny expand/collapse squares @@ -231,38 +211,6 @@ function block_dragover_handler(event) { //event.dataTransfer.dropEffect = "move" } -/*function block_drop_handler(event) { - uninstall_block_drop_zones() - let dropped_on_elt = event.target //the dom elt that the dragged elt has just been dropped on - debugger - console.log("drop client x" + event.clientX) - remove_drop_target_class() - event.preventDefault(); - // Get the id of the target and add the moved element to the target's DOM - let id_of_block = event.dataTransfer.getData("text"); - out(id_of_block) - let elt = document.getElementById(id_of_block) //block being dragged - let delta_x = event.clientX - Workspace.inst.start_drag_client_x - let delta_y = event.clientY - Workspace.inst.start_drag_client_y - let new_x = elt.offsetLeft + delta_x - let new_y = elt.offsetTop + delta_y - if (new_x < 0) { //delete this block - remove_dom_elt(elt); - toolkit_bar_id.style["background-color"] = "#DDDDDD" - clean_up_top_lefts() - return - } - else if (new_x < Workspace.suck_left_margin) { - reposition_top_left_block(elt, new_y) - } - else { //not a top_left block - elt.classList.remove("block-top-left") - elt.classList.add("block-absolute") - elt.style.left = new_x + "px" - elt.style.top = new_y + "px" - } -}*/ - function block_drop_handler(event) { block_being_dragged = null //global on purpose uninstall_block_drop_zones() @@ -289,6 +237,8 @@ function block_drop_handler(event) { workspace_id.insertBefore(make_top_left_spacer(), dropped_on_elt) dragged_elt.classList.remove("block-absolute") //replace not supported on Chrome dragged_elt.classList.add("block-top-left") + dragged_elt.style.left="auto" + dragged_elt.style.top="auto" workspace_id.insertBefore(dragged_elt, dropped_on_elt) //dragged_elt.style.left = 0 + "px" //shouldn't matter } @@ -463,29 +413,3 @@ function reposition_top_left_block(elt, new_y){ elt.classList.add("block-top-left") clean_up_top_lefts() } - -/*function reposition_top_left_block(elt, new_y){ - elt.style.left = "0px" - let tlbs = Workspace.inst.top_left_blocks() //sorted top to bottom - for(let tlb of tlbs) { - - if(tlb != elt){ //because elt may show up in tlbs, and we don't want it too - let tlb_bounding_rect = tlb.getBoundingClientRect() - let tlb_y = tlb_bounding_rect.top - //let tlb_y = px_suffix_string_to_number(tlb.style.top) //can't rely on this - if(tlb_y >= new_y) { //elt goes before this block - let spacer_above_block = make_dom_elt("div", {class:"top-left-spacer"}, " ") - tlb.parentNode.insertBefore(spacer_above_block, tlb) - tlb.parentNode.insertBefore(elt, tlb) - return - } - } - } - let spacer_above_block = make_dom_elt("div", {class:"top-left-spacer"}, " ") - workspace_id.appendChild(spacer_above_block) - workspace_id.appendChild(elt) //workspace_id is same as tlb.parentNode here - elt.classList.remove("block-absolute") - elt.classList.add("block-top-left") //This will cause redrawing. Must be after top_left_blocks call - //so tha that doesn't accidentally pick it up. -} -*/ diff --git a/blocksde/jsdb_newObject.js b/blocksde/jsdb_newObject.js index e0124292..1b28a577 100644 --- a/blocksde/jsdb_newObject.js +++ b/blocksde/jsdb_newObject.js @@ -143,6 +143,7 @@ newObject({ name: "jsdb", methodname:"upper_type", constructor: function(){ + debugger if (typeof(this.category) == "string") { let cat_maybe = Root.BlockCategory.name_to_category(this.category) if (cat_maybe) { this.category = cat_maybe } @@ -185,8 +186,8 @@ newObject({ if (x == null) { x = Workspace.suck_left_margin + 100 } - category_menu_id.style.display = "none" block_type_menu_id.style.display = "none" + category_menu_id.style.display = "none" let elt = this.make_dom_elt(x, y, arg_vals) Workspace.inst.add_block_elt(elt) }, @@ -279,27 +280,10 @@ newObject({prototype: Root.jsdb, } } }, - - /*make_html(){ - return `
-
remainder
( -
- - -
-
-
-
-
-
` - }*/ make_dom_elt: function(x, y, arg_vals){ + let always_rel = make_dom_elt("div", {class: "block_always_relative"}) let result = make_dom_elt("div", - {class:"block block-absolute block_horiz", + {class:"block block-absolute", "background-color": this.category.color, id: Root.jsdb.get_next_block_id(), left: x + "px", @@ -310,10 +294,14 @@ newObject({prototype: Root.jsdb, onclick: "select_block(event)" //position: "absolute" }, - make_dom_elt("div", {class:"block_name"}, this.display_label) + always_rel ) + always_rel.appendChild(make_dom_elt("div", + {class:"block_name"}, + this.display_label)) + let block_args_elt = make_dom_elt("div", {class:"block_args"}) - result.appendChild(block_args_elt) + always_rel.appendChild(block_args_elt) for(let param of this.params){ let param_elt = make_dom_elt("label", {class:"arg_name_val"}, @@ -327,13 +315,14 @@ newObject({prototype: Root.jsdb, ]) block_args_elt.appendChild(param_elt) } - result.appendChild(make_dom_elt("div", {}, - [make_dom_elt("div", {class:"toggle_horiz_vert", - onclick:"toggle_horiz_vert(event)"}), - make_dom_elt("div", {class:"toggle_expand_collapse", - onclick:"toggle_expand_collapse(event)"}) - ])) - make_block_horiz(result) + always_rel.appendChild(make_dom_elt("div", {class:"block_bottom_spacer"})) + always_rel.appendChild(make_dom_elt("div", {class:"resizer", + draggable:"true", + ondragstart:"resizer_dragstart_handler(event)", + ondrag:"resizer_drag_handler(event)", + ondragend:"resizer_dragend_handler(event)", + ondrop:"resizer_drop_handler(event)", + onclick:"resizer_onclick(event)"})) return result }, to_js(block_elt){ @@ -354,6 +343,7 @@ newObject({prototype: Root.jsdb, return_type:"any" , make_dom_elt: function(x, y, arg_vals){ debugger + let always_rel = make_dom_elt("div", {class: "block_always_relative"}) let result = make_dom_elt("div", {class:"block block-absolute", "background-color": this.category.color, @@ -364,33 +354,36 @@ newObject({prototype: Root.jsdb, "data-block-type": "literal." + this.name, onclick: "select_block(event)" }, - make_dom_elt("div", {class:"block_name", display:"inline-block"}, this.display_label) + always_rel ) + always_rel.appendChild(make_dom_elt("div", {class:"block_name", display:"inline-block"}, this.display_label)) + //a key diff between this meth and corresponding meth for "method" //is the display:"inline-block" on block-name, block_args, and arg_name_val //so that we have the 1 param on the top line, same line as block-name let block_args_elt = make_dom_elt("div", {class:"block_args block_args_collapsed"}) // display:"inline-block"}) - result.appendChild(block_args_elt) + always_rel.appendChild(block_args_elt) if(this.params.length == 1) { //excludes literal array which starts with no params let param = this.params[0] let input_elt = param.make_input_elt() let param_elt = - make_dom_elt("label", {class:"arg_name_val arg_name_val_horiz"}, //display:"inline-block"}, + make_dom_elt("label", {class:"arg_name_val"}, //display:"inline-block"}, [make_dom_elt("span", {class:"arg_name", "margin-right": "0px"}, param.display_label), input_elt ]) block_args_elt.appendChild(param_elt) } - else if (this.name == "array") { - this.append_array_begin_and_end(result) + else if (this.name == "array") { //need to do something similar for lit_objs + this.append_array_begin_and_end(always_rel) + always_rel.appendChild(make_dom_elt("div", {class:"block_bottom_spacer"})) + always_rel.appendChild(make_dom_elt("div", {class:"resizer", + draggable:"true", + ondragstart:"resizer_dragstart_handler(event)", + ondrag:"resizer_drag_handler(event)", + ondragend:"resizer_dragend_handler(event)", + ondrop:"resizer_drop_handler(event)", + onclick:"resizer_onclick(event)"})) } - result.appendChild(make_dom_elt("div", {}, - [make_dom_elt("div", {class:"toggle_horiz_vert", - onclick:"toggle_horiz_vert(event)"}), - make_dom_elt("div", {class:"toggle_expand_collapse", - onclick:"toggle_expand_collapse(event)"}) - ])) - make_block_horiz(result) return result }, @@ -428,6 +421,46 @@ newObject({prototype: Root.jsdb, } }) +newObject({prototype: Root.jsdb.literal, + name: "number", + return_type: "number", + min: -Infinity, + max: Infinity, + step: 1, + make_dom_elt: function(x, y, arg_vals){ + let always_rel = make_dom_elt("div", {class: "block_always_relative"}) + let result = make_dom_elt("div", + {class:"block block-absolute", + "background-color": this.category.color, + id: Root.jsdb.get_next_block_id(), + left: x + "px", + top: y + "px", + draggable: "true", + "data-block-type": "literal." + this.name, + onclick: "select_block(event)" + }, + always_rel + ) + //no block name by design: a num should be obviu. Don't take up the space of #, nor the newline usually after the block name + let block_args_elt = make_dom_elt("div", {class:"block_args block_args_collapsed"}) // display:"inline-block"}) + always_rel.appendChild(block_args_elt) + let param_elt = make_dom_elt("input", + {class:"arg_val", + type: "number", + min: this.min, + max: this.max, + step: this.step, + width: 60 + "px", + "margin-left": "0px", + value: this.value, + ondragenter:"enter_drop_target(event)", + ondragleave:"leave_drop_target(event)"}) + + block_args_elt.appendChild(param_elt) + } +}) + + /* jsdb_method.kinds = [] diff --git a/blocksde/style2.css b/blocksde/style2.css index c3f4f237..b2f15c88 100644 --- a/blocksde/style2.css +++ b/blocksde/style2.css @@ -1,4 +1,15 @@ +.categories { + animation-duration: 1s; + animation-name: slidein; +} + +@keyframes slidein { + from { width: 0%;} + to { width: 100%;} +} + + .toolkit_category_name { padding:5px; } @@ -20,25 +31,49 @@ border-style:solid !important; } - .block { + position:relative; /*relative;*/ /*with no top and left specified, they default to 0 so this is a no-op + EXCEPT that it makes it so the resizer drag square can + be absolute positioned against THIS block's container. */ display:inline-block; + /*box-sizing: border-box; includes padding and border in width & height. + Seems like a good idea but screws up dynamic resizing totally */ + vertical-align: top; /* make sure that different height blocks on the same row will have their tops in the same vertical place.*/ + margin-right:5px; + margin-bottom:6px; + /*padding-left: 3px; breaks display*/ + overflow:hidden; + border: 1px solid black; background-color:#AAAAAA; - border-width:1px; - border-color:black; - border-style:solid; - padding-top:3px; - /*cursor: move; obscures clicking on expand squares *//*channges cursor to the 4 arrows "move" cursor when mouse hovers over a block indicating it can be dragged.*/ - /*position:absolute; - left:100px; - top:20px;*/ } /* a given block will always have class "block" and ONE of the below 2 classes */ -.block-absolute { +.block-absolute { /* top level "commented out" block not connected to top left. */ position:absolute; } -.block-top-left { +/* obsolete +.block-relative { a block inside another block. Might be connected to top_left, might not + position:relative; + margin-left:8px; needed for a nested block to be "indented" +}*/ + +/*all blcoks always have their 2nd level in be an .block_always_relative div, +which all other content is in. Necessary to get the resizer div to +be posiitoned in lower right corner, even when the overall block +is top_left, ie of position:static. +So a block has its outermost block div which +is either top-left and thus position: static, or +position: absolute (as a top level comment or +position: relative (is an inerior block within either top_left or absolute. + + */ +.block_always_relative { + position:relative; + margin:0px; + padding:0px; +} + +.block-top-left { /*top level, all the way left on screen.*/ position:static; left: 0px; } @@ -63,46 +98,34 @@ } .block_name { - display:inline; - margin:2px; + margin-left:3px; } .block_args { margin-top:2px; } -/*a block_arg elt always has just 1 of the following 3 classes */ -.block_args_collapsed { /* set on a block that is horiz. implies that all its arg_name_value elts have - class arg_name_value_horiz but doesn't enforce it */ - display:none; -} - -.block_args_horiz { - display:inline; -} - -.block_args_vert { - display:block; -} - .arg_name_val { margin-left:10px; margin-right:10px; margin-top:2px; } -/* a et of arg_name_val should also always have one of arg_name_val_horiz or arg_name_val_vert */ +/* a elt of arg_name_val should also always have one of arg_name_val_horiz or arg_name_val_vert */ +/*obsolete .arg_name_val_horiz { - display:inline; /*inline means horiz which it is by default, but make it "block" for vertical */ +/* + display:inline; inline means horiz which it is by default, but make it "block" for vertical marginLeft:0px; marginRight:10px; } .arg_name_val_vert { - display:block; /*inline means horiz which it is by default, but make it "block" for vertical */ + display:block; inline means horiz which it is by default, but make it "block" for vertical marginLeft:10px; marginRight:0px; } +*/ .arg_name { } @@ -115,30 +138,29 @@ border-color: red; } -.toggle_horiz_vert { /*the little square in the lower left of a block that clicking toggles between horiz and vert.*/ - border-width:1px; - border-color:black; - border-style:solid; - width:5px; - height:5px; - display:inline-block; - float:left; +.block_bottom_spacer{ + height:6px; + margin:0px; + padding:0px; } -.toggle_horiz_vert:hover{ +.resizer { + width:6px; + height:6px; + border:1px solid black; + display:inline-block; + position:absolute; + /*left:calc(100% - 5px); + top:calc(100% - 5px);*/ + bottom:0; + right:0; +} +.resizer:hover{ background-color:black; } -.toggle_expand_collapse { - border-width:1px; - border-color:black; - border-style:solid; - width:5px; - height:5px; +.comma { display:inline-block; - float:right; -} - -.toggle_expand_collapse:hover{ - background-color:black; + margin:0px; + padding:0px; } diff --git a/blocksde/workspace.js b/blocksde/workspace.js index a4f1d122..e1fd4371 100644 --- a/blocksde/workspace.js +++ b/blocksde/workspace.js @@ -71,7 +71,8 @@ var Workspace = class Workspace{ } else { //normal, mouse enters toolbar to pop up category menu //user is drabbing a block into the toolkit bar to delete it. - let the_html = " Categories
" + //debugger + let the_html = "
Categories
" for(let cat of Root.BlockCategory.subObjects()){ the_html += '
' + cat.name + "
" } - category_menu_id.innerHTML = the_html - //category_menu_id.show(); + category_menu_id.innerHTML = the_html+ "
" category_menu_id.style.display = "block" + //category_menu_id.firstChild.classList.add("categories") //this shuld trigger the animation + //category_menu_id.show(); + } } } diff --git a/doc/guide.html b/doc/guide.html index f2cef659..a9982527 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -8,8 +8,8 @@
About This is Dexter Development Environment
- version: 2.3.8
- released: Feb 9, 2018 + version: 2.3.9
+ released: Feb 12, 2018

DDE helps you create, debug, and send software to a Dexter robot. You can use any JavaScript augmented with DDE-specific functions to help find out about, diff --git a/doc/release_notes.html b/doc/release_notes.html index 0ab9b849..89645fb2 100644 --- a/doc/release_notes.html +++ b/doc/release_notes.html @@ -6,6 +6,33 @@ .doc_details summary { font-weight: 600; } +
v 2.3.9, Feb 12, 2018 +Highlights: Bug fixes and UI tweaks. +
    +
  • Fixed output pane height to compute itself for the available space. + Now you can drag the splitter bar between the editor pane up and + the output pane and the OUTPUT (lower) portion of the output pane + will always fill up all the available space.
  • + +
  • Calibration Start buttons J1 thru J4 + now have tooltips of:
    + "Expect a circle of points to be drawn counter-clockwise."
  • + +
  • Calibration Start button J5 + now has a tooltip of:
    + "Expect a circle of points to be drawn clockwise."
  • + +
  • J3 UI section now has the min angle value on the left, + and the max vale value on the right, just + like the other joints.
  • + +
  • File menu item of "Save As..." given a more complete tooltip of:
    + Save the current editor content under a new name.
    + The old file remains unchanged.
    + It will remain on the list of files.
  • +
+
+
v 2.3.8, Feb 9, 2018 Highlights: Fix for Dexter's "jitters" and 6 other bug fixes.
    diff --git a/html_db.js b/html_db.js index c0387689..a9cd2b72 100644 --- a/html_db.js +++ b/html_db.js @@ -631,4 +631,23 @@ function dom_elt_child_of_class(elt, a_class){ if (kid.classList.contains(a_class)) { return kid } } return null +} + +//if elt has a_class. return it, else go up the parentNode until you find one +//or, if not, return null +function first_ancestor_of_class(elt, a_class){ + if (elt == null) { return null } + else if(elt.classList && elt.classList.contains(a_class)) { return elt } + else { return first_ancestor_of_class(elt.parentNode, a_class) } +} + +//possibly includes elt itself. +function ancestors_of_class(elt, a_class){ + let result = [] + while(true) { + if (elt == null) { break } + else if(elt.classList && elt.classList.contains(a_class)) { result.push(elt) } + elt = elt.parentNode + } + return result } \ No newline at end of file diff --git a/index.html b/index.html index 2bd0c73a..0571f997 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - Dexter Development Environment 2.3.8 + Dexter Development Environment 2.3.9 @@ -175,7 +175,7 @@
  • Load...
  • Insert file...
  • Save         Ctrl/⌘s
  • -
  • Save As...
  • +
  • Save As...
  • Remove
  • Update DDE...
@@ -673,7 +673,7 @@  Jobs: -
+
diff --git a/package.json b/package.json index 519267e5..e882e47c 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "dexter_dev_env", "productName": "dexter_dev_env", - "version": "2.3.8", - "release_date": "Feb 9, 2018", + "version": "2.3.9", + "release_date": "Feb 12, 2018", "description": "Dexter Development Environment", "author": "Fry", "license": "GPL-3.0",