mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Add basic context-menu for actions.
This commit is contained in:
parent
c33d95ba7a
commit
f705cd60a7
9 changed files with 86 additions and 4 deletions
|
@ -39,7 +39,8 @@
|
|||
"angular-hotkeys": "chieffancypants/angular-hotkeys#~1.4.5",
|
||||
"angular-borderlayout": "https://github.com/filearts/angular-borderlayout.git",
|
||||
"angular-ui-bootstrap": "~0.11.0",
|
||||
"angular-ladda": "~0.1.6"
|
||||
"angular-ladda": "~0.1.6",
|
||||
"ng-context-menu": "~1.0.0"
|
||||
},
|
||||
"private": true,
|
||||
"resolutions": {
|
||||
|
|
|
@ -393,6 +393,10 @@ module.exports = function DeviceScreenDirective($document, ScalingService,
|
|||
}
|
||||
|
||||
function mouseDownListener(e) {
|
||||
// Skip secondary click
|
||||
if (e.which === 3) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
|
||||
fakePinch = e.altKey
|
||||
|
@ -433,6 +437,10 @@ module.exports = function DeviceScreenDirective($document, ScalingService,
|
|||
}
|
||||
|
||||
function mouseMoveListener(e) {
|
||||
// Skip secondary click
|
||||
if (e.which === 3) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
|
||||
var addGhostFinger = !fakePinch && e.altKey
|
||||
|
@ -477,6 +485,10 @@ module.exports = function DeviceScreenDirective($document, ScalingService,
|
|||
}
|
||||
|
||||
function mouseUpListener(e) {
|
||||
// Skip secondary click
|
||||
if (e.which === 3) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
|
||||
control.touchUp(nextSeq(), 0)
|
||||
|
|
|
@ -66,6 +66,7 @@ module.exports =
|
|||
|
||||
newWindow.onbeforeunload = function () {
|
||||
|
||||
// TODO: check for usage
|
||||
GroupService.kick(device).then(function () {
|
||||
$rootScope.$digest()
|
||||
})
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports =
|
|||
switchCharset: function () {
|
||||
$scope.control.keyPress('switch_charset')
|
||||
},
|
||||
// TODO: Refactor this
|
||||
rotateLeft: function () {
|
||||
var angle = 0
|
||||
if ($scope.device && $scope.device.display) {
|
||||
|
|
|
@ -95,4 +95,32 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService,
|
|||
$scope.currentRotation = 'landscape'
|
||||
}
|
||||
})
|
||||
|
||||
// TODO: Refactor this inside control and server-side
|
||||
$scope.rotateLeft = function () {
|
||||
var angle = 0
|
||||
if ($scope.device && $scope.device.display) {
|
||||
angle = $scope.device.display.rotation
|
||||
}
|
||||
if (angle === 0) {
|
||||
angle = 270
|
||||
} else {
|
||||
angle -= 90
|
||||
}
|
||||
$scope.control.rotate(angle)
|
||||
}
|
||||
|
||||
$scope.rotateRight = function () {
|
||||
var angle = 0
|
||||
if ($scope.device && $scope.device.display) {
|
||||
angle = $scope.device.display.rotation
|
||||
}
|
||||
if (angle === 270) {
|
||||
angle = 0
|
||||
} else {
|
||||
angle += 90
|
||||
}
|
||||
$scope.control.rotate(angle)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,8 +36,36 @@
|
|||
i.fa.fa-times
|
||||
|
||||
.as-row.fill-height
|
||||
div(ng-controller='DeviceScreenCtrl', ng-if='device', ng-file-drop='installFile($files)', ng-file-drag-over-class='dragover').fill-height
|
||||
device-screen(device='device', control='control')
|
||||
|
||||
.dropdown.context-menu(id='context-menu-{{ $index }}')
|
||||
ul.dropdown-menu(role='menu')
|
||||
li
|
||||
a.pointer(role='menuitem', ng-click='control.back(); $event.preventDefault()')
|
||||
i.fa.fa-mail-reply.fa-fw
|
||||
span(translate) Back
|
||||
li
|
||||
a.pointer(role='menuitem', ng-click='control.home(); $event.preventDefault()')
|
||||
i.fa.fa-home.fa-fw
|
||||
span(translate) Home
|
||||
li.divider
|
||||
li
|
||||
a.pointer(role='menuitem', ng-click='rotateRight(); $event.preventDefault()')
|
||||
i.fa.fa-rotate-left.fa-fw
|
||||
span(translate) Rotate Left
|
||||
li
|
||||
a.pointer(role='menuitem', ng-click='rotateLeft(); $event.preventDefault()')
|
||||
i.fa.fa-rotate-right.fa-fw
|
||||
span(translate) Rotate Right
|
||||
li.divider
|
||||
li
|
||||
a.pointer(role='menuitem', ng-click='kickDevice(device); $event.preventDefault()')
|
||||
i.fa.fa-sign-out.fa-fw
|
||||
span(translate) Stop Using
|
||||
|
||||
div(ng-controller='DeviceScreenCtrl', ng-if='device',
|
||||
ng-file-drop='installFile($files)', ng-file-drag-over-class='dragover').fill-height
|
||||
div(context-menu, data-target='context-menu-{{ $index }}').fill-height
|
||||
device-screen(device='device', control='control')
|
||||
|
||||
.stf-vnc-bottom.as-row(ng-hide='$root.standalone')
|
||||
.controls
|
||||
|
|
|
@ -3,7 +3,8 @@ require('./device-control.css')
|
|||
module.exports = angular.module('device-control', [
|
||||
require('stf/device').name,
|
||||
require('stf/control').name,
|
||||
require('stf/screen').name
|
||||
require('stf/screen').name,
|
||||
require('ng-context-menu').name
|
||||
])
|
||||
.run(["$templateCache", function ($templateCache) {
|
||||
$templateCache.put('control-panes/device-control/device-control.jade',
|
||||
|
|
4
res/web_modules/ng-context-menu/context-menu.css
Normal file
4
res/web_modules/ng-context-menu/context-menu.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
.context-menu {
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
}
|
6
res/web_modules/ng-context-menu/index.js
Normal file
6
res/web_modules/ng-context-menu/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
require('ng-context-menu/dist/ng-context-menu')
|
||||
require('./context-menu.css')
|
||||
|
||||
module.exports = {
|
||||
name: 'ng-context-menu'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue