Commit ab2f5609 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

revert to using SVG background image, add "experimental" to description

parent c14dc7e1
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
"footgun": "Footgun" "footgun": "Footgun"
}, },
"grid": { "grid": {
"show_grid": "snap to grid", "show_grid": "snap to grid (experimental)",
"show_grid_tt": "Snap to the grid in edit mode" "show_grid_tt": "Snap to the grid in edit mode"
}, },
"zoom": { "zoom": {
......
...@@ -1442,8 +1442,6 @@ function get_grid_coords(cid, svg_elem) { ...@@ -1442,8 +1442,6 @@ function get_grid_coords(cid, svg_elem) {
// the same grid with a lower opacity. That way the edit mode is always // the same grid with a lower opacity. That way the edit mode is always
// visually distinct from run mode. // visually distinct from run mode.
var create_editmode_bg = function(cid, svg_elem) { var create_editmode_bg = function(cid, svg_elem) {
return "linear-gradient(transparent 9px, rgba(220,220,200,.8) 10px, transparent 10px), linear-gradient(90deg, transparent 9px, rgba(220,220,200,.8) 10px, transparent 10px)";
var head, body, tail, cell_data_str, opacity_str, grid, size, pos; var head, body, tail, cell_data_str, opacity_str, grid, size, pos;
grid = showgrid[cid]; grid = showgrid[cid];
size = gridsize[cid]; size = gridsize[cid];
...@@ -1479,16 +1477,9 @@ var create_editmode_bg = function(cid, svg_elem) { ...@@ -1479,16 +1477,9 @@ var create_editmode_bg = function(cid, svg_elem) {
function set_editmode_bg(cid, svg_elem, state) function set_editmode_bg(cid, svg_elem, state)
{ {
// If we're setting the bg, figure out the correct offset first
// if (state) {
// set_grid_position(cid, svg_elem);
// }
patchwin[cid].window.document.body.style.setProperty("background-image", patchwin[cid].window.document.body.style.setProperty("background-image",
state ? state ?
create_editmode_bg(cid, svg_elem) : "none"); create_editmode_bg(cid, svg_elem) : "none");
patchwin[cid].window.document.body.style.setProperty("background-size",
"100% 10px, 10px 100%");
} }
function update_svg_background(cid, svg_elem) { function update_svg_background(cid, svg_elem) {
...@@ -6826,7 +6817,10 @@ function do_getscroll(cid, checkgeom) { ...@@ -6826,7 +6817,10 @@ function do_getscroll(cid, checkgeom) {
width: width, width: width,
height: height height: height
}); });
// Now update the svg's background if we're in edit mode // Now update the svg's background if we're in edit mode. This adds
// a new background image to the body of the document each time.
// So if there is a performance regression with do_getscroll when
// in editmode, this could be the culprit.
update_svg_background(cid, svg_elem); update_svg_background(cid, svg_elem);
}); });
} }
......
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