Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Suraj Modi
purr-data
Commits
c14dc7e1
Commit
c14dc7e1
authored
Nov 01, 2020
by
Jonathan Wilkes
Browse files
interim state testing out pure-CSS grid
parent
3c186b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
pd/nw/pdgui.js
View file @
c14dc7e1
...
@@ -1442,6 +1442,8 @@ function get_grid_coords(cid, svg_elem) {
...
@@ -1442,6 +1442,8 @@ 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
];
...
@@ -1453,7 +1455,7 @@ var create_editmode_bg = function(cid, svg_elem) {
...
@@ -1453,7 +1455,7 @@ var create_editmode_bg = function(cid, svg_elem) {
cell_data_str
=
[
'
"
'
,
"
M
"
,
size
,
0
,
"
L
"
,
0
,
0
,
0
,
size
,
'
"
'
].
join
(
"
"
);
cell_data_str
=
[
'
"
'
,
"
M
"
,
size
,
0
,
"
L
"
,
0
,
0
,
0
,
size
,
'
"
'
].
join
(
"
"
);
head
=
[
'
<svg xmlns="http://www.w3.org/2000/svg"
'
,
head
=
[
'
<svg xmlns="http://www.w3.org/2000/svg"
'
,
'
width="100" height="100"
'
,
'
width="100
0
" height="100
0
"
'
,
'
opacity=
'
,
opacity_str
,
'
>
'
]
'
opacity=
'
,
opacity_str
,
'
>
'
]
.
join
(
""
);
.
join
(
""
);
body
=
[
'
<defs>
'
,
body
=
[
'
<defs>
'
,
...
@@ -1464,12 +1466,12 @@ var create_editmode_bg = function(cid, svg_elem) {
...
@@ -1464,12 +1466,12 @@ var create_editmode_bg = function(cid, svg_elem) {
'
</pattern>
'
,
'
</pattern>
'
,
'
<pattern id="grid" patternUnits="userSpaceOnUse"
'
,
'
<pattern id="grid" patternUnits="userSpaceOnUse"
'
,
'
width="100" height="100" x="
'
,
pos
.
x
,
'
" y="
'
,
pos
.
y
,
'
">
'
,
'
width="100" height="100" x="
'
,
pos
.
x
,
'
" y="
'
,
pos
.
y
,
'
">
'
,
'
<rect width="
1
00" height="
1
00" fill="url(#cell)" />
'
,
'
<rect width="
5
00" height="
5
00" fill="url(#cell)" />
'
,
'
<path fill="none" stroke="#bbb" stroke-width="1"
'
,
'
<path fill="none" stroke="#bbb" stroke-width="1"
'
,
'
d="M
1
00 0 L 0 0 0
1
00"/>
'
,
'
d="M
5
00 0 L 0 0 0
5
00"/>
'
,
'
</pattern>
'
,
'
</pattern>
'
,
'
</defs>
'
,
'
</defs>
'
,
'
<rect width="100" height="100" fill="url(#grid)" />
'
'
<rect width="100
0
" height="100
0
" fill="url(#grid)" />
'
].
join
(
""
);
].
join
(
""
);
tail
=
'
</svg>
'
;
tail
=
'
</svg>
'
;
return
"
url('data:image/svg+xml;utf8,
"
+
head
+
body
+
tail
+
"
')
"
;
return
"
url('data:image/svg+xml;utf8,
"
+
head
+
body
+
tail
+
"
')
"
;
...
@@ -1484,6 +1486,9 @@ function set_editmode_bg(cid, svg_elem, state)
...
@@ -1484,6 +1486,9 @@ function set_editmode_bg(cid, svg_elem, state)
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
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment