Commit 86018bba018f6ed0c8646ff1570c75fd77c24d46

Authored by Igor Kulikov
1 parent f5b42f09

UI: Improve digital gauge - horizontal bar.

... ... @@ -29,7 +29,8 @@ export default function AliasesEntitySelectPanelController(mdPanelRef, $scope, $
29 29 var allEntityAliases = vm.aliasController.getEntityAliases();
30 30 for (var aliasId in allEntityAliases) {
31 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 34 vm.entityAliasesInfo[aliasId] = angular.copy(aliasInfo);
34 35 vm.entityAliasesInfo[aliasId].selectedId = aliasInfo.currentEntity.id;
35 36 }
... ...
... ... @@ -338,6 +338,8 @@ function barDimensions(context, options, x, y, w, h) {
338 338 bd.height = w / aspect;
339 339 }
340 340
  341 + bd.origBaseX = bd.baseX;
  342 + bd.origBaseY = bd.baseY;
341 343 bd.baseX += (w - bd.width) / 2;
342 344 bd.baseY += (h - bd.height) / 2;
343 345
... ... @@ -432,15 +434,15 @@ function barDimensions(context, options, x, y, w, h) {
432 434
433 435 if (options.hideMinMax && options.label === '') {
434 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 439 } else {
438 440 context.font = canvasGauges.drawings.font(options, 'MinMax', bd.fontSizeFactor);
439 441 var minTextWidth = context.measureText(options.minValue+'').width;
440 442 var maxTextWidth = context.measureText(options.maxValue+'').width;
441 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 446 bd.barLeft = bd.minX;
445 447 bd.barRight = bd.maxX;
446 448 bd.labelY = bd.barBottom + (8 + options.fontLabelSize) * bd.fontSizeFactor;
... ...