Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
digilib-pivaj
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel ANTELME
digilib-pivaj
Commits
cd2967ab
Commit
cd2967ab
authored
10 years ago
by
hertzhaft
Browse files
Options
Downloads
Patches
Plain Diff
snapToUnit now working
parent
e1da4e92
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+17
-17
17 additions, 17 deletions
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
with
17 additions
and
17 deletions
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+
17
−
17
View file @
cd2967ab
...
...
@@ -864,7 +864,7 @@
manipulatePosition
(
shape
,
lockDimension
(
'
x
'
));
}
if
(
keystate
[
'
s
'
]
!=
null
)
{
// snap to next unit
manipulatePosition
(
shape
,
snap
t
oUnit
(
data
));
manipulatePosition
(
shape
,
snap
T
oUnit
(
data
));
}
// console.debug('onPositionShape', shape.properties.screenpos);
};
...
...
@@ -1044,7 +1044,7 @@
};
// disable the calibration input
var
setInputState
=
function
(
data
)
{
var
set
Calibration
InputState
=
function
(
data
)
{
var
widgets
=
data
.
measureWidgets
;
var
type
=
getActiveShapeType
(
data
);
var
display
=
data
.
settings
.
shapeInfo
[
type
].
display
;
...
...
@@ -1054,30 +1054,31 @@
};
// returns a screenpoint manipulation function
var
snap
t
oUnit
=
function
(
data
)
{
var
snap
T
oUnit
=
function
(
data
)
{
// snap to the next rounded unit distance
var
snap
=
function
(
shape
)
{
return
function
(
shape
)
{
var
props
=
shape
.
properties
;
var
screenpos
=
props
.
screenpos
;
var
vtx
=
props
.
vtx
;
if
(
screenpos
==
null
||
vtx
==
null
)
{
return
;
}
var
last
=
getLastVertex
(
shape
);
var
last
Pos
=
screenpos
[
last
];
var
last
Pos
=
screenpos
[
getLastVertex
(
shape
)
]
;
var
this
Pos
=
screenpos
[
vtx
];
// mouse position
var
fac
=
data
.
measureFactor
;
var
dist
=
getVertexDistance
(
data
,
shape
)
*
fac
;
var
round
=
Math
.
round
(
dist
);
// to the nearest integer
var
newPos
=
lastPos
.
scale
(
screenpos
[
vtx
],
round
/
dist
);
console
.
debug
(
lastPos
.
x
,
screenpos
[
vtx
].
x
,
'
[
'
,
dist
,
'
]
'
,
newPos
.
x
);
shape
.
geometry
.
coordinates
[
vtx
]
=
data
.
imgTrafo
.
invtransform
(
thisPos
);
var
unitDist
=
getVertexDistance
(
data
,
shape
)
*
fac
;
var
roundDist
=
Math
.
round
(
unitDist
);
// round to the nearest integer
var
newPos
=
(
roundDist
===
0
)
?
thisPos
:
lastPos
.
scale
(
thisPos
,
roundDist
/
unitDist
);
// calculate snap position
screenpos
[
vtx
].
moveTo
(
newPos
);
}
return
snap
;
};
};
// returns a screenpoint manipulation function
var
lockDimension
=
function
(
dim
)
{
// lock one dimension of the current screen pos to that of the previous
var
lock
=
function
(
shape
)
{
return
function
(
shape
)
{
var
props
=
shape
.
properties
;
var
startpos
=
props
.
startpos
;
var
screenpos
=
props
.
screenpos
;
...
...
@@ -1085,8 +1086,7 @@
if
(
startpos
==
null
||
screenpos
==
null
||
vtx
==
null
)
{
return
;
}
screenpos
[
vtx
][
dim
]
=
startpos
[
dim
];
}
return
lock
;
};
};
// manipulate the screen points of the shape
...
...
@@ -1103,13 +1103,13 @@
// set the current shape type (from shape select widget)
var
changeShapeType
=
function
(
data
)
{
data
.
settings
.
activeShapeType
=
data
.
measureWidgets
.
shape
.
val
();
setInputState
(
data
);
set
Calibration
InputState
(
data
);
};
// set the current shape type
var
setActiveShapeType
=
function
(
data
,
type
)
{
data
.
settings
.
activeShapeType
=
type
;
setInputState
(
data
);
set
Calibration
InputState
(
data
);
};
// update Line Style classes (overwrite CSS)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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