Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
minerva
core
Commits
e0a5a1e9
Commit
e0a5a1e9
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
computing distance between element and coordinates sometimes returned invalid (low) value
parent
656bd882
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!678
Merge 12.2.0 beta.2 into master
,
!677
12.2.0~beta.2 into master
,
!676
Devel 12.2.0~beta.2 into master
,
!672
Resolve "Compartment annotation"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG
+2
-0
2 additions, 0 deletions
CHANGELOG
frontend-js/src/main/js/map/CustomMap.js
+1
-1
1 addition, 1 deletion
frontend-js/src/main/js/map/CustomMap.js
frontend-js/src/test/js/map/CustomMap-test.js
+80
-0
80 additions, 0 deletions
frontend-js/src/test/js/map/CustomMap-test.js
with
83 additions
and
1 deletion
CHANGELOG
+
2
−
0
View file @
e0a5a1e9
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: clicking outside of the element sometimes resulted with the
invalid element highlighted (#324)
* Bug fix: parent compartment/pathway use proper type name in left panel
(#324)
* Bug fix: editing/removing project requires Map Management privilege (#681)
...
...
This diff is collapsed.
Click to expand it.
frontend-js/src/main/js/map/CustomMap.js
+
1
−
1
View file @
e0a5a1e9
...
...
@@ -1235,7 +1235,7 @@ CustomMap.prototype.getDistance = function (params) {
var
elementWidth
=
element
.
getWidth
();
var
elementHeight
=
element
.
getHeight
();
return
Math
.
min
(
Functions
.
distance
(
p1
,
new
Point
(
elementX
,
y
)),
Functions
.
distance
(
p1
,
new
Point
(
elementX
,
elementY
)),
Functions
.
distance
(
p1
,
new
Point
(
elementX
+
elementWidth
,
elementY
)),
Functions
.
distance
(
p1
,
new
Point
(
elementX
,
elementY
+
elementHeight
)),
Functions
.
distance
(
p1
,
new
Point
(
elementX
+
elementWidth
,
elementY
+
elementHeight
))
...
...
This diff is collapsed.
Click to expand it.
frontend-js/src/test/js/map/CustomMap-test.js
+
80
−
0
View file @
e0a5a1e9
...
...
@@ -1017,4 +1017,84 @@ describe('CustomMap', function () {
return
map
.
getControl
(
ControlType
.
LOGO_IMG
).
onclick
()
});
});
describe
(
"
getDistance
"
,
function
()
{
it
(
"
inside element
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
100
,
200
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
0
,
distance
);
return
map
.
destroy
();
});
});
it
(
"
to the left
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
1
,
200
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
49
,
distance
);
return
map
.
destroy
();
});
});
it
(
"
to the right
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
161
,
200
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
11
,
distance
);
return
map
.
destroy
();
});
});
it
(
"
to the top
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
100
,
11
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
49
,
distance
);
return
map
.
destroy
();
});
});
it
(
"
to the bottom
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
100
,
300
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
40
,
distance
);
return
map
.
destroy
();
});
});
it
(
"
corner
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
alias
=
helper
.
createAlias
(
map
);
alias
.
setX
(
50
);
alias
.
setY
(
60
);
alias
.
setWidth
(
100
);
alias
.
setHeight
(
200
);
var
ie
=
new
IdentifiedElement
(
alias
);
return
map
.
getDistance
({
modelId
:
map
.
getId
(),
coordinates
:
new
Point
(
46
,
57
),
element
:
ie
}).
then
(
function
(
distance
){
assert
.
equal
(
5
,
distance
);
return
map
.
destroy
();
});
});
});
});
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