feat(dev): Added path.noop/path.insop example
This commit is contained in:
parent
337a1e9f8c
commit
e7250f0bc0
5 changed files with 90 additions and 5 deletions
|
@ -6,6 +6,33 @@ title: insop()
|
|||
Path path.insop(string id, Path path)
|
||||
```
|
||||
|
||||
Injects a Path into the [`noop` operation](#noop) with id `id`.
|
||||
Injects a Path into the [`noop` operation](/reference/api/path/noop) with id `id`.
|
||||
|
||||
<Fixme>Add example</Fixme>
|
||||
<Tip compact>This is often used to insert darts into a path</Tip>
|
||||
|
||||
<Example part="path_noop">
|
||||
Example of the Path.noop() method
|
||||
</Example>
|
||||
|
||||
```js
|
||||
points.left = new Point(10,10)
|
||||
points.dartLeft = new Point(40, 10)
|
||||
points.dartTip = new Point(50, 50)
|
||||
points.dartRight = new Point(60, 10)
|
||||
points.right = new Point(90, 10)
|
||||
|
||||
paths.withoutDart = new Path()
|
||||
.move(points.left)
|
||||
.line(points.dartLeft)
|
||||
.noop('dart')
|
||||
.line(points.right)
|
||||
|
||||
paths.withDart = paths.without
|
||||
.insop(
|
||||
'dart',
|
||||
new Path()
|
||||
.line(points.dartTip)
|
||||
.line(points.dartRight)
|
||||
)
|
||||
.attr('style', 'stroke-width: 2px; stroke-opacity: 0.5; stroke: orange;')
|
||||
```
|
||||
|
|
|
@ -6,7 +6,36 @@ title: noop()
|
|||
Path path.noop(string id)
|
||||
```
|
||||
|
||||
Adds a placeholder path opertion.\
|
||||
A `noop` operation does nothing, but is intended to be replaced later with [`Path.insop()`](#insop).
|
||||
Adds a placeholder path operation.
|
||||
|
||||
<Fixme>Add example</Fixme>
|
||||
A `noop` operation does nothing, but is intended to be replaced later
|
||||
with [`Path.insop()`](/reference/api/path/insop).
|
||||
|
||||
<Tip compact>This is often used to insert darts into a path</Tip>
|
||||
|
||||
<Example part="path_noop">
|
||||
Example of the Path.noop() method
|
||||
</Example>
|
||||
|
||||
```js
|
||||
points.left = new Point(10,10)
|
||||
points.dartLeft = new Point(40, 10)
|
||||
points.dartTip = new Point(50, 50)
|
||||
points.dartRight = new Point(60, 10)
|
||||
points.right = new Point(90, 10)
|
||||
|
||||
paths.withoutDart = new Path()
|
||||
.move(points.left)
|
||||
.line(points.dartLeft)
|
||||
.noop('dart')
|
||||
.line(points.right)
|
||||
|
||||
paths.withDart = paths.without
|
||||
.insop(
|
||||
'dart',
|
||||
new Path()
|
||||
.line(points.dartTip)
|
||||
.line(points.dartRight)
|
||||
)
|
||||
.attr('style', 'stroke-width: 2px; stroke-opacity: 0.5; stroke: orange;')
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue