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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin BARDIAUX
Blob Analysis Lab Ecole
Commits
bfc734ef
Commit
bfc734ef
authored
2 years ago
by
Laurent Knoll
Browse files
Options
Downloads
Patches
Plain Diff
Ajout de poignées supplémentaires sur le tracé de la boîte de petri. Closes #1
parent
fad4f68e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/instruments/petriDish.ts
+34
-4
34 additions, 4 deletions
src/instruments/petriDish.ts
with
34 additions
and
4 deletions
src/instruments/petriDish.ts
+
34
−
4
View file @
bfc734ef
import
*
as
paper
from
"
paper
"
;
import
*
as
paper
from
"
paper
"
;
import
{
AbstractInstrument
,
Handle
,
Instrument
}
from
"
./instrument
"
;
import
{
AbstractInstrument
,
Handle
,
Instrument
}
from
"
./instrument
"
;
import
{
CircleCoords
}
from
"
../data/coords/circleCoords
"
;
import
{
Lab
}
from
"
../lab
"
;
import
{
Lab
}
from
"
../lab
"
;
import
{
EllipseCoords
}
from
"
../data/coords/ellipseCoords
"
;
import
{
EllipseCoords
}
from
"
../data/coords/ellipseCoords
"
;
...
@@ -14,6 +13,8 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
...
@@ -14,6 +13,8 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
new
Handle
(
"
rightHandle
"
,
true
),
new
Handle
(
"
rightHandle
"
,
true
),
new
Handle
(
"
bottomHandle
"
,
true
),
new
Handle
(
"
bottomHandle
"
,
true
),
new
Handle
(
"
centerHandle
"
,
true
),
new
Handle
(
"
centerHandle
"
,
true
),
new
Handle
(
"
topHandle
"
,
true
),
new
Handle
(
"
leftHandle
"
,
true
),
])
])
}
}
...
@@ -23,11 +24,12 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
...
@@ -23,11 +24,12 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
onHandleMove
(
coords
:
EllipseCoords
,
handle
:
Handle
,
point
:
paper
.
Point
,
delta
:
paper
.
Point
):
void
{
onHandleMove
(
coords
:
EllipseCoords
,
handle
:
Handle
,
point
:
paper
.
Point
,
delta
:
paper
.
Point
):
void
{
switch
(
handle
.
name
)
{
switch
(
handle
.
name
)
{
case
"
centerHandle
"
:
case
"
centerHandle
"
:
{
coords
.
center
=
coords
.
center
.
add
(
delta
);
coords
.
center
=
coords
.
center
.
add
(
delta
);
break
;
break
;
}
case
"
rightHandle
"
:
case
"
rightHandle
"
:
{
let
newRadiusX
=
point
.
x
-
coords
.
center
.
x
;
let
newRadiusX
=
point
.
x
-
coords
.
center
.
x
;
let
deltaRadiusX
=
newRadiusX
-
coords
.
radiusX
;
let
deltaRadiusX
=
newRadiusX
-
coords
.
radiusX
;
if
(
newRadiusX
>
10
)
{
if
(
newRadiusX
>
10
)
{
...
@@ -35,8 +37,19 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
...
@@ -35,8 +37,19 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
coords
.
center
=
coords
.
center
.
add
(
new
paper
.
Point
(
deltaRadiusX
/
2
,
0
));
coords
.
center
=
coords
.
center
.
add
(
new
paper
.
Point
(
deltaRadiusX
/
2
,
0
));
}
}
break
;
break
;
}
case
"
bottomHandle
"
:
case
"
leftHandle
"
:
{
let
newRadiusX
=
coords
.
center
.
x
-
point
.
x
;
let
deltaRadiusX
=
newRadiusX
-
coords
.
radiusX
;
if
(
newRadiusX
>
10
)
{
coords
.
radiusX
=
coords
.
radiusX
+
deltaRadiusX
/
2
;
coords
.
center
=
coords
.
center
.
subtract
(
new
paper
.
Point
(
deltaRadiusX
/
2
,
0
));
}
break
;
}
case
"
bottomHandle
"
:
{
let
newRadiusY
=
point
.
y
-
coords
.
center
.
y
;
let
newRadiusY
=
point
.
y
-
coords
.
center
.
y
;
let
deltaRadiusY
=
newRadiusY
-
coords
.
radiusY
;
let
deltaRadiusY
=
newRadiusY
-
coords
.
radiusY
;
if
(
newRadiusY
>
10
)
{
if
(
newRadiusY
>
10
)
{
...
@@ -45,6 +58,17 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
...
@@ -45,6 +58,17 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
}
}
break
;
break
;
}
}
case
"
topHandle
"
:
{
let
newRadiusY
=
coords
.
center
.
y
-
point
.
y
;
let
deltaRadiusY
=
newRadiusY
-
coords
.
radiusY
;
if
(
newRadiusY
>
10
)
{
coords
.
radiusY
=
coords
.
radiusY
+
deltaRadiusY
/
2
;
coords
.
center
=
coords
.
center
.
subtract
(
new
paper
.
Point
(
0
,
deltaRadiusY
/
2
));
}
break
;
}
}
}
}
locateHandle
(
coords
:
EllipseCoords
,
handle
:
Handle
):
paper
.
Point
{
locateHandle
(
coords
:
EllipseCoords
,
handle
:
Handle
):
paper
.
Point
{
...
@@ -55,9 +79,15 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
...
@@ -55,9 +79,15 @@ export class PetriDish extends AbstractInstrument<EllipseCoords> implements Inst
case
"
rightHandle
"
:
case
"
rightHandle
"
:
return
coords
.
center
.
add
(
new
paper
.
Point
(
coords
.
radiusX
,
0
));
return
coords
.
center
.
add
(
new
paper
.
Point
(
coords
.
radiusX
,
0
));
case
"
leftHandle
"
:
return
coords
.
center
.
subtract
(
new
paper
.
Point
(
coords
.
radiusX
,
0
));
case
"
bottomHandle
"
:
case
"
bottomHandle
"
:
return
coords
.
center
.
add
(
new
paper
.
Point
(
0
,
coords
.
radiusY
));
return
coords
.
center
.
add
(
new
paper
.
Point
(
0
,
coords
.
radiusY
));
case
"
topHandle
"
:
return
coords
.
center
.
subtract
(
new
paper
.
Point
(
0
,
coords
.
radiusY
));
default
:
default
:
throw
new
Error
(
"
Unknown handle
"
);
throw
new
Error
(
"
Unknown handle
"
);
}
}
...
...
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