Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mxtommy/kip

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mxtommy/kip - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

public/main.6898e9dd9c22e015cd5a.js

2

package.json
{
"name": "@mxtommy/kip",
"version": "0.1.9",
"version": "0.1.10",
"license": "MIT",

@@ -5,0 +5,0 @@ "keywords": [

@@ -17,3 +17,3 @@ import { Injectable } from '@angular/core';

const defaultTheme = 'default-light';
const configVersion = 2; // used to invalidate old configs to avoir errors loading it.
const configVersion = 3; // used to invalidate old configs to avoir errors loading it.

@@ -20,0 +20,0 @@

export const DemoConfig = {
"configVersion": 1,
"configVersion": 3,
"signalKUrl": "http://demo.signalk.org",
"signalKToken": null,
"themeName": "default-light",

@@ -25,2 +26,4 @@ "widgets": [

"selfPaths": true,
"showMin": true,
"showMax": false,
"numDecimal": 1,

@@ -148,2 +151,4 @@ "numInt": 1

"selfPaths": true,
"showMin": false,
"showMax": true,
"numDecimal": 1,

@@ -170,2 +175,4 @@ "numInt": 1

"selfPaths": true,
"showMin": false,
"showMax": false,
"numDecimal": 1,

@@ -172,0 +179,0 @@ "numInt": 1

@@ -26,2 +26,4 @@ import { Injectable } from '@angular/core';

numInt?: number;
showMin?: boolean;
showMax?: boolean;

@@ -28,0 +30,0 @@ //Wind Gague data

@@ -10,2 +10,3 @@ import { Component, Input, OnInit, OnDestroy, Inject, ViewChild, ElementRef, AfterViewChecked } from '@angular/core';

import { isNumeric } from 'rxjs/util/isNumeric';
import { isNull } from '@angular/compiler/src/output/output_ast';

@@ -29,2 +30,4 @@

selfPaths: true,
showMax: false,
showMin: false,
numDecimal: 1,

@@ -50,2 +53,4 @@ numInt: 1

dataValue: number = null;
maxValue: number = null;
minValue: number = null;
dataTimestamp: number = Date.now();

@@ -110,2 +115,7 @@

this.dataValue = this.UnitsService.convertUnit(this.config.units['numericPath'], newValue);
// init min/max
if (this.minValue === null) { this.minValue = this.dataValue; }
if (this.maxValue === null) { this.maxValue = this.dataValue; }
if (this.dataValue > this.maxValue) { this.maxValue = this.dataValue; }
if (this.dataValue < this.minValue) { this.minValue = this.dataValue; }
this.updateCanvas();

@@ -163,2 +173,5 @@ }

this.drawUnit();
if (this.config.showMax || this.config.showMin) {
this.drawMinMax();
}
}

@@ -240,5 +253,36 @@ }

drawMinMax() {
var maxTextWidth = Math.floor(this.canvasEl.nativeElement.width - (this.canvasEl.nativeElement.width * 0.6));
var maxTextHeight = Math.floor(this.canvasEl.nativeElement.height - (this.canvasEl.nativeElement.height * 0.85));
// set font small and make bigger until we hit a max.
let valueText: string = '';
if (this.config.showMin) {
if (isNumeric(this.minValue)) {
valueText = valueText + " Min: " + this.padValue(this.minValue.toFixed(this.config.numDecimal), this.config.numInt, this.config.numDecimal);
} else {
valueText = valueText + " Min: --";
}
}
if (this.config.showMax) {
if (isNumeric(this.maxValue)) {
valueText = valueText + " Max: " + this.padValue(this.maxValue.toFixed(this.config.numDecimal), this.config.numInt, this.config.numDecimal);
} else {
valueText = valueText + " Max: --";
}
}
valueText = valueText.trim();
var fontSize = 1;
this.canvasCtx.fillStyle = window.getComputedStyle(this.wrapperDiv.nativeElement).color;
this.canvasCtx.font = "bold " + fontSize.toString() + "px Arial"; // need to init it so we do loop at least once :)
while ( (this.canvasCtx.measureText(valueText).width < maxTextWidth) && (fontSize < maxTextHeight)) {
fontSize++;
this.canvasCtx.font = "bold " + fontSize.toString() + "px Arial";
}
this.canvasCtx.textAlign = "left";
this.canvasCtx.textBaseline="bottom";
this.canvasCtx.fillText(valueText,this.canvasEl.nativeElement.width*0.03,this.canvasEl.nativeElement.height*0.97, maxTextWidth);
}
padValue(val, int, dec) {

@@ -245,0 +289,0 @@ let i = 0;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc