Commit 9696d216 authored by Zack Lee's avatar Zack Lee
Browse files

fix bugs related to null div element by checking type and fix menuclose and...

fix bugs related to null div element by checking type and fix menuclose and allow shortcut while editing and fix garray being opened if the patch font size is different from the system font size and change the default font size to 10
parent e955785c
......@@ -11,22 +11,12 @@
## Setup
In this project you will need Node.JS. You can follow [this guide](https://github.com/itp-dwd/2020-spring/blob/master/guides/installing-nodejs.md) to install it.
1. Clone this repository
2. Run
2. Build
```
$ make emscripten
```
3. Install necessary dependencies
```
$ npm install
```
4. Build pdbundle
```
npm run-script build
```
5. Start the application
```
npm start
```
3. The project directory to host the web app is `purr-data/emscripten/project/purr-data`
4. You can run `npm start` under the project directory to run the app
## Known bugs list
- The view options still not implemented.
......@@ -37,10 +27,6 @@ In this project you will need Node.JS. You can follow [this guide](https://githu
- If you create an object (e.g. [spigot]) and open a help file, scroll to the right end of the help file, then close the help file, the mouse coordinate doesn't work correctly in the first patch
- If you create an audio object (e.g. [osc~], [phasor~]) turn the DSP on, then open and close its help file, the GUI no longer responses to my mouse click. (seems to be frozen)
- If you create an audio object (e.g. [phasor~]) and open/close its help file for many times(e.g. > 20 times), it gets slower and slower opening the file. (takes a few seconds to open after opening/closing 20 times)
- Split patch canvas in half just works if you don't grow your patch more than half of the canvas container
If you found any bugs, please let us know. You can contact using [mailing list](http://disis.music.vt.edu/listinfo/l2ork-dev) or create an issue;
\ No newline at end of file
If you found any bugs, please let us know. You can contact using [mailing list](http://disis.music.vt.edu/listinfo/l2ork-dev) or create an issue;
......@@ -446,9 +446,8 @@ var canvas_events = (function() {
// prevent the default behavior of scrolling
// on arrow keys in editmode
var patchid = pdgui.is_webapp() ? "#patchsvg_"+name : "#patchsvg"
if (document.querySelector(patchid)
.classList.contains("editmode")) {
const elem = document.querySelector(patchid);
if (elem && elem.classList.contains("editmode")) {
if ([32, 37, 38, 39, 40].indexOf(evt.keyCode) > -1) {
evt.preventDefault();
}
......@@ -493,6 +492,11 @@ var canvas_events = (function() {
return false;
},
text_keydown: function(evt) {
if (pdgui.is_webapp()) { // temporary fix
if (pdgui.cmd_or_ctrl_key(evt) && evt.altKey) {
return false;
}
}
evt.stopPropagation();
//evt.preventDefault();
return false;
......@@ -1339,7 +1343,7 @@ function register_window_id(cid, attr_array) {
pdgui.update_focused_windows(cid);
// Force font size 10
pdgui.pdsend(cid, "font", 16, 8, 100,0);
pdgui.pdsend(cid, "font", 10, 8, 100,0);
}
......@@ -1404,7 +1408,9 @@ class Popup {
// Close after click
this.popup_elem.onclick = function(e){
var ul_node = e.target.parentNode;
ul_node.parentNode.removeChild(ul_node);
if (ul_node !== document.body) {
ul_node.parentNode.removeChild(ul_node);
}
}
}
......
......@@ -1091,7 +1091,7 @@ function menu_close(name) {
// not handling the "text editor" yet
// not handling the "Window" menu yet
//pdtk_canvas_checkgeometry $name
pdsend(name + " menuclose 0");
pdsend(name + " menuclose 1"); // currently, we just force quit(1) on web without canvas_menuclose_callback
}
exports.menu_close = menu_close;
......@@ -2194,7 +2194,9 @@ function configure_item(item, attributes) {
} else {
for (attr in attributes) {
if (attributes.hasOwnProperty(attr)) {
item.setAttributeNS(null, attr, attributes[attr]);
if (item) {
item.setAttributeNS(null, attr, attributes[attr]);
}
}
}
}
......@@ -2268,7 +2270,9 @@ var gui = (function() {
append: !w ? null_fn: function(cb) {
var frag = w.window.document.createDocumentFragment();
frag = cb(frag, w.window, c[cid]);
last_thing.appendChild(frag);
if (last_thing) {
last_thing.appendChild(frag);
}
return c[cid];
},
get_gobj: !w ? null_fn : function(sel, arg) {
......@@ -6066,7 +6070,9 @@ function gui_textarea(cid, tag, type, x, y, width_spec, height_spec, text,
if(is_webapp()){
var div_p = patchwin[cid].window.document.getElementById("div-svg-p");
div_p.parentNode.removeChild(div_p);
if (div_p) {
div_p.parentNode.removeChild(div_p);
}
}
}
}
......@@ -6094,7 +6100,12 @@ function canvas_params(nw_win, cid)
var bbox, width, height, min_width, min_height, x, y, svg_elem;
var patchsvg_id = is_webapp() ? "patchsvg_"+cid : "patchsvg";
svg_elem = nw_win.window.document.getElementById(patchsvg_id);
bbox = svg_elem.getBBox();
if (svg_elem) {
bbox = svg_elem.getBBox();
}
else {
bbox = {x: 0, y: 0, width: 0, height: 0};
}
// We try to do Pd-extended style canvas origins. That is, coord (0, 0)
// should be in the top-left corner unless there are objects with a
// negative x or y.
......@@ -6120,8 +6131,11 @@ function canvas_params(nw_win, cid)
// of them. This could lead to some problems with event handlers but I
// haven't had a problem with it yet.
if(is_webapp()){
min_width = document.getElementById(patchsvg_id).getBoundingClientRect().width;
min_height = document.getElementById(patchsvg_id).getBoundingClientRect().height;
const elem = document.getElementById(patchsvg_id);
if (elem) {
min_width = elem.getBoundingClientRect().width;
min_height = elem.getBoundingClientRect().height;
}
}else{
min_width = nw_win.window.innerWidth - 4;
min_height = nw_win.window.innerHeight - 4;
......
......@@ -443,6 +443,9 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
if (sys_zoom && zoom_hack > 0)
zoom = calculate_zoom(zoom_hack);
}
#ifdef __EMSCRIPTEN__
font = 10; /* temporary fix to prevent garray being opened: force font size to 10 */
#endif
/* (otherwise assume we're being created from the menu.) */
if (canvas_newdirectory->s_name[0])
......
Supports Markdown
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