Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
[~]drawing-functions.md: updated line_func()
authored
Apr 09, 2020
by
gibbonjoyeux
Show whitespace changes
Inline
Side-by-side
api/drawing-functions.md
View page @
ccebbfd2
...
@@ -106,11 +106,17 @@ Calls the passed function for each point of the line formed by `[x0, y0]` and
...
@@ -106,11 +106,17 @@ Calls the passed function for each point of the line formed by `[x0, y0]` and
of the current point and a boolean variable which is set to
`true`
when the
of the current point and a boolean variable which is set to
`true`
when the
coordinates are inside the active layer.
coordinates are inside the active layer.
If the passed function returns
`true`
to it's call,
`line_func()`
will stop.
Here is an example of a function passed to
`line_func()`
:
Here is an example of a function passed to
`line_func()`
:
```
javascript
```
javascript
function
(
x
,
y
,
is_on_layer
)
{
function
my_line_drawing
(
x
,
y
,
is_on_layer
)
{
if
(
is_on_layer
==
true
)
{
if
(
is_on_layer
==
true
)
{
if
(
my_layer
[
y
][
x
]
==
'
'
)
{
my_layer
[
y
][
x
]
=
'
#
'
;
my_layer
[
y
][
x
]
=
'
#
'
;
}
else
{
return
(
true
);
}
}
}
}
}
```
```
...
...
...
...