Commit 86018bba018f6ed0c8646ff1570c75fd77c24d46
1 parent
f5b42f09
UI: Improve digital gauge - horizontal bar.
Showing
2 changed files
with
8 additions
and
5 deletions
@@ -29,7 +29,8 @@ export default function AliasesEntitySelectPanelController(mdPanelRef, $scope, $ | @@ -29,7 +29,8 @@ export default function AliasesEntitySelectPanelController(mdPanelRef, $scope, $ | ||
29 | var allEntityAliases = vm.aliasController.getEntityAliases(); | 29 | var allEntityAliases = vm.aliasController.getEntityAliases(); |
30 | for (var aliasId in allEntityAliases) { | 30 | for (var aliasId in allEntityAliases) { |
31 | var aliasInfo = vm.aliasController.getInstantAliasInfo(aliasId); | 31 | var aliasInfo = vm.aliasController.getInstantAliasInfo(aliasId); |
32 | - if (aliasInfo && !aliasInfo.resolveMultiple && aliasInfo.currentEntity) { | 32 | + if (aliasInfo && !aliasInfo.resolveMultiple && aliasInfo.currentEntity |
33 | + && aliasInfo.resolvedEntities.length > 1) { | ||
33 | vm.entityAliasesInfo[aliasId] = angular.copy(aliasInfo); | 34 | vm.entityAliasesInfo[aliasId] = angular.copy(aliasInfo); |
34 | vm.entityAliasesInfo[aliasId].selectedId = aliasInfo.currentEntity.id; | 35 | vm.entityAliasesInfo[aliasId].selectedId = aliasInfo.currentEntity.id; |
35 | } | 36 | } |
@@ -338,6 +338,8 @@ function barDimensions(context, options, x, y, w, h) { | @@ -338,6 +338,8 @@ function barDimensions(context, options, x, y, w, h) { | ||
338 | bd.height = w / aspect; | 338 | bd.height = w / aspect; |
339 | } | 339 | } |
340 | 340 | ||
341 | + bd.origBaseX = bd.baseX; | ||
342 | + bd.origBaseY = bd.baseY; | ||
341 | bd.baseX += (w - bd.width) / 2; | 343 | bd.baseX += (w - bd.width) / 2; |
342 | bd.baseY += (h - bd.height) / 2; | 344 | bd.baseY += (h - bd.height) / 2; |
343 | 345 | ||
@@ -432,15 +434,15 @@ function barDimensions(context, options, x, y, w, h) { | @@ -432,15 +434,15 @@ function barDimensions(context, options, x, y, w, h) { | ||
432 | 434 | ||
433 | if (options.hideMinMax && options.label === '') { | 435 | if (options.hideMinMax && options.label === '') { |
434 | bd.labelY = bd.barBottom; | 436 | bd.labelY = bd.barBottom; |
435 | - bd.barLeft = options.fontMinMaxSize/3 * bd.fontSizeFactor; | ||
436 | - bd.barRight = bd.width - options.fontMinMaxSize/3 * bd.fontSizeFactor; | 437 | + bd.barLeft = bd.origBaseX + options.fontMinMaxSize/3 * bd.fontSizeFactor; |
438 | + bd.barRight = bd.bd.origBaseX + w + /*bd.width*/ - options.fontMinMaxSize/3 * bd.fontSizeFactor; | ||
437 | } else { | 439 | } else { |
438 | context.font = canvasGauges.drawings.font(options, 'MinMax', bd.fontSizeFactor); | 440 | context.font = canvasGauges.drawings.font(options, 'MinMax', bd.fontSizeFactor); |
439 | var minTextWidth = context.measureText(options.minValue+'').width; | 441 | var minTextWidth = context.measureText(options.minValue+'').width; |
440 | var maxTextWidth = context.measureText(options.maxValue+'').width; | 442 | var maxTextWidth = context.measureText(options.maxValue+'').width; |
441 | var maxW = Math.max(minTextWidth, maxTextWidth); | 443 | var maxW = Math.max(minTextWidth, maxTextWidth); |
442 | - bd.minX = bd.baseX + maxW/2 + options.fontMinMaxSize/3 * bd.fontSizeFactor; | ||
443 | - bd.maxX = bd.baseX + bd.width - maxW/2 - options.fontMinMaxSize/3 * bd.fontSizeFactor; | 444 | + bd.minX = bd.origBaseX + maxW/2 + options.fontMinMaxSize/3 * bd.fontSizeFactor; |
445 | + bd.maxX = bd.origBaseX + w + /*bd.width*/ - maxW/2 - options.fontMinMaxSize/3 * bd.fontSizeFactor; | ||
444 | bd.barLeft = bd.minX; | 446 | bd.barLeft = bd.minX; |
445 | bd.barRight = bd.maxX; | 447 | bd.barRight = bd.maxX; |
446 | bd.labelY = bd.barBottom + (8 + options.fontLabelSize) * bd.fontSizeFactor; | 448 | bd.labelY = bd.barBottom + (8 + options.fontLabelSize) * bd.fontSizeFactor; |