Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drawing-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sweng-group-15
drawing-app
Commits
0e2fc545
Commit
0e2fc545
authored
5 years ago
by
Yuriy Maksymets
Browse files
Options
Downloads
Patches
Plain Diff
Not drawing the last point if not needed
parent
1dee92bf
No related branches found
No related tags found
2 merge requests
!57
Erasure intervals
,
!48
Intuitive erasing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app.js
+26
-2
26 additions, 2 deletions
src/app.js
with
26 additions
and
2 deletions
src/app.js
+
26
−
2
View file @
0e2fc545
...
...
@@ -172,9 +172,31 @@ function pointWasErased(eraseIntervals) {
)
}
function
needToDrawLastPoint
(
points
,
pathID
)
{
if
(
points
.
length
<
2
)
return
true
const
penultimatePointIndex
=
points
.
length
-
2
const
penPointEraseIntervals
=
getEraseIntervals
(
pathID
,
penultimatePointIndex
,
)
if
(
penPointEraseIntervals
&&
penPointEraseIntervals
.
length
&&
penPointEraseIntervals
.
some
(
(
interval
)
=>
interval
[
1
]
>=
1
-
POINT_ERASE_LIMIT
,
)
)
{
return
false
}
return
true
}
function
generatePointsForPathElem
(
pathElem
,
pathID
,
dataPoints
)
{
const
points
=
dataPoints
document
.
getElementById
(
"
console
"
).
innerText
=
JSON
.
stringify
(
TEST_ERASE_INTERVAL
,
)
const
appendToWholePath
=
(
subPath
)
=>
{
if
(
!
(
subPath
&&
subPath
.
length
))
return
const
subpathElem
=
generateSvgForSubpath
(
subPath
)
...
...
@@ -225,7 +247,9 @@ function generatePointsForPathElem(pathElem, pathID, dataPoints) {
}
}
appendToWholePath
(
subPath
)
if
(
needToDrawLastPoint
(
points
,
pathID
))
{
appendToWholePath
(
subPath
)
}
}
const
addOrUpdatePathElem
=
(
pathElems
,
id
,
points
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment