Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
digilib-pivaj
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel ANTELME
digilib-pivaj
Commits
c48f9cc4
Commit
c48f9cc4
authored
Feb 03, 2015
by
hertzhaft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toggle SVG and key handler according to visibility of measure bar
parent
8b34e2bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+30
-1
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+8
-8
No files found.
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
View file @
c48f9cc4
...
...
@@ -773,7 +773,9 @@
$measureBar
=
setupMeasureBar
(
data
);
};
$measureBar
.
toggle
();
setScreenPosition
(
data
,
$measureBar
);
var
on
=
$measureBar
.
is
(
"
:visible
"
);
setKeyHandler
(
data
,
on
);
showSVG
(
data
,
on
);
return
;
},
drawshape
:
function
(
data
)
{
...
...
@@ -1017,6 +1019,17 @@
$u2
.
children
(
'
:not(:disabled)
'
)[
data
.
settings
.
unitTo
].
selected
=
true
;
};
// show or hide SVG element
var
showSVG
=
function
(
data
,
on
)
{
var
layers
=
data
.
vectorLayers
;
if
(
layers
==
null
)
return
;
$svg
=
layers
[
0
].
$elem
;
if
(
on
)
{
$svg
.
removeAttr
(
"
display
"
);
}
else
{
$svg
.
attr
(
"
display
"
,
"
none
"
);
}
};
// initial position of measure bar (bottom left of browser window)
var
setScreenPosition
=
function
(
data
,
$div
)
{
if
(
$div
==
null
)
return
;
...
...
@@ -1041,6 +1054,21 @@
return
false
;
};
// keydown handler when measure bar is visible
var
onKeyDown
=
function
(
event
,
data
)
{
console
.
debug
(
'
measure: keyDown
'
,
event
.
key
)
};
// setup a div for accessing the measure functionality
var
setKeyHandler
=
function
(
data
,
on
)
{
if
(
on
)
{
$
(
document
.
body
).
on
(
'
keydown.measure
'
,
function
(
evt
)
{
onKeyDown
(
evt
,
data
)
}
)}
else
{
$
(
document
.
body
).
off
(
'
keydown.measure
'
)
}
};
// setup a div for accessing the measure functionality
var
setupMeasureBar
=
function
(
data
)
{
console
.
debug
(
'
measure: setupMeasureBar
'
);
...
...
@@ -1074,6 +1102,7 @@
populateShapeSelect
(
data
);
populateUnitSelects
(
data
);
setupMeasureWidgets
(
data
);
setScreenPosition
(
data
,
$measureBar
);
widgets
.
move
.
on
(
'
mousedown.measure
'
,
dragMeasureBar
);
return
$measureBar
;
};
...
...
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
View file @
c48f9cc4
...
...
@@ -55,12 +55,12 @@
var
digilib
=
null
;
// SVG namespace
var
svgNS
=
'
http://www.w3.org/2000/svg
'
;
// implemented shape types
var
supportedShapeTypes
=
[
'
Line
'
,
'
Rectangle
'
,
'
LineString
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
];
var
defaults
=
{
// is vector active?
'
isVectorActive
'
:
true
,
// implemented shape types
'
supportedShapeTypes
'
:
[
'
Line
'
,
'
Rectangle
'
,
'
LineString
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
],
// default SVG stroke
'
defaultStroke
'
:
'
red
'
,
// default SVG stroke-width
...
...
@@ -298,7 +298,7 @@
'
style
'
:
'
position:absolute; z-index:10; pointer-events:none;
'
});
$svg
=
$
(
svgElem
);
layer
.
svgElem
=
svgElem
;
layer
.
$elem
=
$svg
;
layer
.
$elem
=
$svg
;
for
(
var
i
=
0
;
i
<
shapes
.
length
;
++
i
)
{
var
shape
=
shapes
[
i
];
renderShape
(
data
,
shape
,
layer
);
...
...
@@ -546,7 +546,7 @@
}
}
// update shape object and trigger drag event
if
(
isSupported
(
shapeType
))
{
if
(
isSupported
(
data
,
shapeType
))
{
var
p
=
data
.
imgTrafo
.
invtransform
(
pt
);
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p
.
x
,
p
.
y
];
$
(
data
).
trigger
(
'
dragShape
'
,
shape
);
...
...
@@ -563,7 +563,7 @@
pt
.
clipTo
(
imgRect
);
var
p1
=
data
.
imgTrafo
.
invtransform
(
pt
);
// update shape object
if
(
isSupported
(
shapeType
))
{
if
(
isSupported
(
data
,
shapeType
))
{
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p1
.
x
,
p1
.
y
];
}
// remove move/end handler
...
...
@@ -590,8 +590,8 @@
*
* @param shapeType shapeType to test
*/
var
isSupported
=
function
(
shapeType
)
{
return
$
.
inArray
(
shapeType
,
supportedShapeTypes
)
>
-
1
;
var
isSupported
=
function
(
data
,
shapeType
)
{
return
$
.
inArray
(
shapeType
,
data
.
settings
.
supportedShapeTypes
)
>
-
1
;
};
/**
...
...
@@ -625,7 +625,7 @@
var
vtxidx
=
1
;
if
(
shapeType
===
'
Point
'
)
{
shape
.
geometry
.
coordinates
=
[[
p
.
x
,
p
.
y
]];
}
else
if
(
isSupported
(
shapeType
))
{
}
else
if
(
isSupported
(
data
,
shapeType
))
{
shape
.
geometry
.
coordinates
=
[[
p
.
x
,
p
.
y
],
[
p
.
x
,
p
.
y
]];
}
else
{
console
.
error
(
"
defineShape: unsupported shape type:
"
+
shapeType
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment