Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Blob Analysis Lab Ecole
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Benjamin BARDIAUX
Blob Analysis Lab Ecole
Commits
7b8bc5d9
Commit
7b8bc5d9
authored
2 years ago
by
Laurent Knoll
Browse files
Options
Downloads
Patches
Plain Diff
Meilleure gestion de la souris sur le tracé manuel
parent
8cc83e1a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/instruments/blobMask.ts
+24
-6
24 additions, 6 deletions
src/instruments/blobMask.ts
with
24 additions
and
6 deletions
src/instruments/blobMask.ts
+
24
−
6
View file @
7b8bc5d9
...
...
@@ -51,7 +51,7 @@ export class BlobMask extends AbstractInstrument<PathCoords> implements Instrume
}
this
.
wasClosed
=
isClosed
;
if
(
DEBUG_MODE
)
{
if
(
DEBUG_MODE
)
{
// Traces les contours convexes et fitted ellipse
if
(
this
.
drawGroup
.
bounds
.
area
>
10
)
{
let
fittedEllipse
=
new
ToEllipseFitter
().
transform
(
this
.
coords
).
toRemovedPath
();
fittedEllipse
.
strokeColor
=
new
paper
.
Color
(
"
red
"
);
...
...
@@ -89,6 +89,7 @@ export class BlobMask extends AbstractInstrument<PathCoords> implements Instrume
*/
public
onActivation
()
{
if
(
!
this
.
lab
.
raster
.
data
.
blobMaskAttached
)
{
this
.
lab
.
raster
.
on
(
"
mousedown
"
,
this
.
onMouseDown
.
bind
(
this
));
this
.
lab
.
raster
.
on
(
"
mousedrag
"
,
this
.
onMouseDrag
.
bind
(
this
));
this
.
lab
.
raster
.
data
.
blobMaskAttached
=
true
;
}
...
...
@@ -97,18 +98,35 @@ export class BlobMask extends AbstractInstrument<PathCoords> implements Instrume
/**
* Lorsque quelque chose est déplacé de la règle
*/
private
onMouseDrag
(
event
:
paper
.
MouseEvent
)
:
boolean
{
private
addMousePoint
(
point
:
paper
.
Point
)
{
if
(
!
this
.
coords
.
isClosed
())
{
// Une fois la boucle fermée, on ne peut plus ajouter de
this
.
coords
.
points
.
push
(
point
)
this
.
refresh
();
}
return
true
;
}
private
onMouseDown
(
event
:
paper
.
MouseEvent
)
:
boolean
{
if
(
!
this
.
active
)
{
return
true
;
}
if
(
!
this
.
coords
.
isClosed
())
{
// Une fois la boucle fermée, on ne peut plus ajouter de
this
.
coords
.
points
.
push
(
event
.
point
)
this
.
addMousePoint
(
event
.
point
);
return
true
;
}
/**
* Déplacement de la souris
*/
private
onMouseDrag
(
event
:
paper
.
MouseEvent
)
:
boolean
{
if
(
!
this
.
active
)
{
return
true
;
}
this
.
refresh
(
);
this
.
addMousePoint
(
event
.
point
);
return
true
;
}
protected
fillColor
(
active
:
boolean
,
coords
:
PathCoords
):
paper
.
Color
|
null
{
protected
override
fillColor
(
active
:
boolean
,
coords
:
PathCoords
):
paper
.
Color
|
null
{
if
(
coords
.
isClosed
())
{
let
fillColor
=
active
?
new
paper
.
Color
(
"
yellow
"
)
:
new
paper
.
Color
(
"
olive
"
);
fillColor
.
alpha
=
0.5
;
...
...
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