add ptz
This commit is contained in:
parent
546795c2b6
commit
f1c953c615
|
@ -128,7 +128,10 @@ class API(object):
|
|||
'RIGHT_UP', 'RIGHT_DOWN',
|
||||
'IN', 'OUT',
|
||||
):
|
||||
direction = getattr(ctl.camera, data['direction'])
|
||||
direction = getattr(ctl.camera, data['direction']).copy()
|
||||
speed = int(data.get('speed', 1))
|
||||
for key in direction:
|
||||
direction[key] *= speed
|
||||
ctl.camera.momentary(direction, float(data.get('duration', 1)))
|
||||
return result
|
||||
|
||||
|
|
|
@ -663,3 +663,21 @@ function init_shift() {
|
|||
setInterval(updateShiftStatus, 5000)
|
||||
})
|
||||
}
|
||||
|
||||
function init_ptz() {
|
||||
var ptz = document.querySelector('#ptz')
|
||||
if (ptz) {
|
||||
ptz.querySelectorAll('button').forEach(button => {
|
||||
button.addEventListener('click', event => {
|
||||
var duration = parseFloat(ptz.querySelector('input[name="duration"]').value)
|
||||
var speed = parseInt(ptz.querySelector('input[name="speed"]').value)
|
||||
api('move', {
|
||||
direction: button.dataset.direction,
|
||||
duration: duration,
|
||||
speed: speed
|
||||
}, response=> {})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
61
static/ptz.html
Normal file
61
static/ptz.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>CAMP can capture canals</title>
|
||||
<link rel="stylesheet" href="/static/sg/css/smoothness/jquery-ui-1.8.16.custom.css" type="text/css"/>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="/static/sg/lib/jquery-1.7.min.js"></script>
|
||||
<script src="/static/sg/lib/jquery-ui-1.8.16.custom.min.js"></script>
|
||||
<script src="/static/sg/lib/jquery.event.drag-2.2.js"></script>
|
||||
<script src="/static/sg/lib/jquery.event.drop-2.2.js"></script>
|
||||
<script src="/static/sg/slick.core.js"></script>
|
||||
<script src="/static/sg/plugins/slick.cellrangedecorator.js"></script>
|
||||
<script src="/static/sg/plugins/slick.cellrangeselector.js"></script>
|
||||
<script src="/static/sg/plugins/slick.cellselectionmodel.js"></script>
|
||||
<script src="/static/sg/plugins/slick.rowmovemanager.js"></script>
|
||||
<script src="/static/sg/slick.formatters.js"></script>
|
||||
<script src="/static/sg/slick.editors.js"></script>
|
||||
<script src="/static/sg/slick.grid.js"></script>
|
||||
|
||||
<script src="/static/js/cccc.js"></script>
|
||||
|
||||
<div id="ptz" style="width: 256px;text-align: center;">
|
||||
<div>
|
||||
<div>
|
||||
<button data-direction="LEFT_UP">↖</button>
|
||||
<button data-direction="UP" title="up">↑</button>
|
||||
<button data-direction="RIGHT_UP">↗</button>
|
||||
</div>
|
||||
<div>
|
||||
<button data-direction="LEFT" title="left">←</button>
|
||||
<div style="width: 64px;display: inline-block;"></div>
|
||||
<button data-direction="RIGHT" title="right">→</button>
|
||||
</div>
|
||||
<div>
|
||||
<button data-direction="LEFT_DOWN">↙</button>
|
||||
<button data-direction="DOWN" title="down">↓</button>
|
||||
<button data-direction="RIGHT_DOWN">↘</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button data-direction="IN">zoom in</button>
|
||||
<button data-direction="OUT">zoom out</button>
|
||||
<br>
|
||||
Speed: <input name="speed" value="1"></input>
|
||||
<br>
|
||||
Duration: <input name="duration" value="4"></input>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
init_ptz()
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user