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
c48f9cc4
Commit
c48f9cc4
authored
10 years ago
by
hertzhaft
Browse files
Options
Downloads
Patches
Plain Diff
toggle SVG and key handler according to visibility of measure bar
parent
8b34e2bb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+30
-1
30 additions, 1 deletion
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+8
-8
8 additions, 8 deletions
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
with
38 additions
and
9 deletions
webapp/src/main/webapp/jquery/jquery.digilib.measure.js
+
30
−
1
View file @
c48f9cc4
...
@@ -773,7 +773,9 @@
...
@@ -773,7 +773,9 @@
$measureBar
=
setupMeasureBar
(
data
);
$measureBar
=
setupMeasureBar
(
data
);
};
};
$measureBar
.
toggle
();
$measureBar
.
toggle
();
setScreenPosition
(
data
,
$measureBar
);
var
on
=
$measureBar
.
is
(
"
:visible
"
);
setKeyHandler
(
data
,
on
);
showSVG
(
data
,
on
);
return
;
return
;
},
},
drawshape
:
function
(
data
)
{
drawshape
:
function
(
data
)
{
...
@@ -1017,6 +1019,17 @@
...
@@ -1017,6 +1019,17 @@
$u2
.
children
(
'
:not(:disabled)
'
)[
data
.
settings
.
unitTo
].
selected
=
true
;
$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)
// initial position of measure bar (bottom left of browser window)
var
setScreenPosition
=
function
(
data
,
$div
)
{
var
setScreenPosition
=
function
(
data
,
$div
)
{
if
(
$div
==
null
)
return
;
if
(
$div
==
null
)
return
;
...
@@ -1041,6 +1054,21 @@
...
@@ -1041,6 +1054,21 @@
return
false
;
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
// setup a div for accessing the measure functionality
var
setupMeasureBar
=
function
(
data
)
{
var
setupMeasureBar
=
function
(
data
)
{
console
.
debug
(
'
measure: setupMeasureBar
'
);
console
.
debug
(
'
measure: setupMeasureBar
'
);
...
@@ -1074,6 +1102,7 @@
...
@@ -1074,6 +1102,7 @@
populateShapeSelect
(
data
);
populateShapeSelect
(
data
);
populateUnitSelects
(
data
);
populateUnitSelects
(
data
);
setupMeasureWidgets
(
data
);
setupMeasureWidgets
(
data
);
setScreenPosition
(
data
,
$measureBar
);
widgets
.
move
.
on
(
'
mousedown.measure
'
,
dragMeasureBar
);
widgets
.
move
.
on
(
'
mousedown.measure
'
,
dragMeasureBar
);
return
$measureBar
;
return
$measureBar
;
};
};
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+
8
−
8
View file @
c48f9cc4
...
@@ -55,12 +55,12 @@
...
@@ -55,12 +55,12 @@
var
digilib
=
null
;
var
digilib
=
null
;
// SVG namespace
// SVG namespace
var
svgNS
=
'
http://www.w3.org/2000/svg
'
;
var
svgNS
=
'
http://www.w3.org/2000/svg
'
;
// implemented shape types
var
supportedShapeTypes
=
[
'
Line
'
,
'
Rectangle
'
,
'
LineString
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
];
var
defaults
=
{
var
defaults
=
{
// is vector active?
// is vector active?
'
isVectorActive
'
:
true
,
'
isVectorActive
'
:
true
,
// implemented shape types
'
supportedShapeTypes
'
:
[
'
Line
'
,
'
Rectangle
'
,
'
LineString
'
,
'
Polygon
'
,
'
Circle
'
,
'
Ellipse
'
],
// default SVG stroke
// default SVG stroke
'
defaultStroke
'
:
'
red
'
,
'
defaultStroke
'
:
'
red
'
,
// default SVG stroke-width
// default SVG stroke-width
...
@@ -298,7 +298,7 @@
...
@@ -298,7 +298,7 @@
'
style
'
:
'
position:absolute; z-index:10; pointer-events:none;
'
});
'
style
'
:
'
position:absolute; z-index:10; pointer-events:none;
'
});
$svg
=
$
(
svgElem
);
$svg
=
$
(
svgElem
);
layer
.
svgElem
=
svgElem
;
layer
.
svgElem
=
svgElem
;
layer
.
$elem
=
$svg
;
layer
.
$elem
=
$svg
;
for
(
var
i
=
0
;
i
<
shapes
.
length
;
++
i
)
{
for
(
var
i
=
0
;
i
<
shapes
.
length
;
++
i
)
{
var
shape
=
shapes
[
i
];
var
shape
=
shapes
[
i
];
renderShape
(
data
,
shape
,
layer
);
renderShape
(
data
,
shape
,
layer
);
...
@@ -546,7 +546,7 @@
...
@@ -546,7 +546,7 @@
}
}
}
}
// update shape object and trigger drag event
// update shape object and trigger drag event
if
(
isSupported
(
shapeType
))
{
if
(
isSupported
(
data
,
shapeType
))
{
var
p
=
data
.
imgTrafo
.
invtransform
(
pt
);
var
p
=
data
.
imgTrafo
.
invtransform
(
pt
);
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p
.
x
,
p
.
y
];
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p
.
x
,
p
.
y
];
$
(
data
).
trigger
(
'
dragShape
'
,
shape
);
$
(
data
).
trigger
(
'
dragShape
'
,
shape
);
...
@@ -563,7 +563,7 @@
...
@@ -563,7 +563,7 @@
pt
.
clipTo
(
imgRect
);
pt
.
clipTo
(
imgRect
);
var
p1
=
data
.
imgTrafo
.
invtransform
(
pt
);
var
p1
=
data
.
imgTrafo
.
invtransform
(
pt
);
// update shape object
// update shape object
if
(
isSupported
(
shapeType
))
{
if
(
isSupported
(
data
,
shapeType
))
{
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p1
.
x
,
p1
.
y
];
shape
.
geometry
.
coordinates
[
vtx
]
=
[
p1
.
x
,
p1
.
y
];
}
}
// remove move/end handler
// remove move/end handler
...
@@ -590,8 +590,8 @@
...
@@ -590,8 +590,8 @@
*
*
* @param shapeType shapeType to test
* @param shapeType shapeType to test
*/
*/
var
isSupported
=
function
(
shapeType
)
{
var
isSupported
=
function
(
data
,
shapeType
)
{
return
$
.
inArray
(
shapeType
,
supportedShapeTypes
)
>
-
1
;
return
$
.
inArray
(
shapeType
,
data
.
settings
.
supportedShapeTypes
)
>
-
1
;
};
};
/**
/**
...
@@ -625,7 +625,7 @@
...
@@ -625,7 +625,7 @@
var
vtxidx
=
1
;
var
vtxidx
=
1
;
if
(
shapeType
===
'
Point
'
)
{
if
(
shapeType
===
'
Point
'
)
{
shape
.
geometry
.
coordinates
=
[[
p
.
x
,
p
.
y
]];
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
]];
shape
.
geometry
.
coordinates
=
[[
p
.
x
,
p
.
y
],
[
p
.
x
,
p
.
y
]];
}
else
{
}
else
{
console
.
error
(
"
defineShape: unsupported shape type:
"
+
shapeType
);
console
.
error
(
"
defineShape: unsupported shape type:
"
+
shapeType
);
...
...
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