diff --git a/res/app/components/stf/screen/fast-image-render/index.js b/res/app/components/stf/screen/fast-image-render/index.js
index 57a71479..9e46d4cd 100644
--- a/res/app/components/stf/screen/fast-image-render/index.js
+++ b/res/app/components/stf/screen/fast-image-render/index.js
@@ -16,7 +16,7 @@ CanvasRender.prototype.draw = function (image) {
}
CanvasRender.prototype.clear = function () {
- this.context.clearRect(0, 0, this.displayWidth, this.displayHeight)
+ this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height)
}
diff --git a/res/app/components/stf/screen/screen-controller.js b/res/app/components/stf/screen/screen-controller.js
index 05c6b3c1..4c4eb463 100644
--- a/res/app/components/stf/screen/screen-controller.js
+++ b/res/app/components/stf/screen/screen-controller.js
@@ -1,19 +1,5 @@
module.exports = function DeviceScreenCtrl($scope, $rootScope, ScalingService) {
$scope.displayError = false
- $scope.canView = true
- $scope.showScreen = true
$scope.ScalingService = ScalingService
- var deregisterPageHidden = $rootScope.$on('pageHidden', function () {
- $scope.canView = false
- })
-
- var deregisterPageVisible = $rootScope.$on('pageVisible', function () {
- $scope.canView = true
- })
-
- $scope.$on('$destroy', function() {
- deregisterPageHidden()
- deregisterPageVisible()
- })
}
diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js
index 20a8600f..4ec5e109 100644
--- a/res/app/components/stf/screen/screen-directive.js
+++ b/res/app/components/stf/screen/screen-directive.js
@@ -103,7 +103,7 @@ module.exports = function DeviceScreenDirective(
}
function maybeLoadScreen() {
- if (!loading && scope.canView && scope.showScreen && scope.device) {
+ if (!loading && scope.$parent.showScreen && scope.device) {
loading = true
imageRender.load(scope.device.display.url +
'?width=' + boundingWidth +
@@ -122,7 +122,7 @@ module.exports = function DeviceScreenDirective(
imageRender.onLoad = function (image) {
loading = false
- if (scope.canView && scope.showScreen) {
+ if (scope.$parent.showScreen) {
// Check to set the size only if updated
if (cachedBoundingWidth !== boundingWidth ||
@@ -215,21 +215,13 @@ module.exports = function DeviceScreenDirective(
element.unbind('mousedown', downListener)
}
- scope.$watch('canView', function (val) {
+ scope.$watch('$parent.showScreen', function (val) {
if (val) {
maybeLoadScreen()
} else {
scope.fps = null
- //imageRender.clear()
- }
- })
+ imageRender.clear()
- scope.$watch('showScreen', function (val) {
- if (val) {
- maybeLoadScreen()
- } else {
- scope.fps = null
- //imageRender.clear()
}
})
diff --git a/res/app/control-panes/device-control/device-control-controller.js b/res/app/control-panes/device-control/device-control-controller.js
index 71c48d63..b19c6983 100644
--- a/res/app/control-panes/device-control/device-control-controller.js
+++ b/res/app/control-panes/device-control/device-control-controller.js
@@ -2,6 +2,8 @@ var _ = require('lodash')
module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, $location) {
+ $scope.showScreen = true
+
$scope.groupTracker = DeviceService.trackGroup($scope)
$scope.groupDevices = $scope.groupTracker.devices
diff --git a/res/app/control-panes/device-control/device-control.jade b/res/app/control-panes/device-control/device-control.jade
index af3c6873..7505f6b9 100644
--- a/res/app/control-panes/device-control/device-control.jade
+++ b/res/app/control-panes/device-control/device-control.jade
@@ -16,9 +16,10 @@
button(type='button', ng-click='control.rotate(90)', tooltip='Landscape', tooltip-placement='bottom').btn.btn-sm.btn-primary-outline
i.fa.fa-mobile.fa-rotate-90
+ // NOTE: ui-bootstrap bug: tooltip breaks btn-checkbox so don't put in the same button
button(type='button', ng-model='showScreen', btn-checkbox).btn.btn-sm.btn-danger
- i(ng-show='showScreen', tooltip-html-unsafe='{{"Just control device"|translate}}
⌘-⇧-O', tooltip-placement='left').fa.fa-eye
- i(ng-show='!showScreen', tooltip-html-unsafe='{{"View device"|translate}}
⌘-⇧-O', tooltip-placement='left').fa.fa-eye-slash
+ i(ng-show='showScreen', tooltip-html-unsafe='{{"Hide Screen"|translate}}', tooltip-placement='bottom').fa.fa-eye
+ i(ng-show='!showScreen', tooltip-html-unsafe='{{"Show Screen"|translate}}', tooltip-placement='bottom').fa.fa-eye-slash
.device-name-container(dropdown)
a.stf-vnc-device-name.pointer.unselectable.dropdown-toggle