Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const {fontName, fontSize, fontWeight, fontStyle}= drawParams;
const color = drawParams.color || drawObj.color || 'black';
const devicePt= plot.getDeviceCoords(inPt);
//if (!plot.pointOnDisplay(devicePt)) {
if (!devicePt) {
return false;
}
let {x,y}= devicePt;
let textHeight= 12;
if (validator.isFloat(fontSize.substring(0, fontSize.length - 2))) {
textHeight = parseFloat(fontSize.substring(0, fontSize.length - 2)) * 14 / 10;
}
const textWidth = textHeight*text.length*8/20;
if (textOffset) {
x+=textOffset.x;
y+=textOffset.y;
}
if (x<2) {
if (x<=-textWidth) return false; // don't draw
x = 2;
}
if (y<2) {
// further investigated)
isTransformationChecked = true;
break;
case 'i':
unit = RegionValueUnit.IMAGE_PIXEL;
break;
default:
unit = RegionValueUnit.CONTEXT;
}
nstr = vstr.substring(0, vstr.length-1);
} else {
nstr = vstr.slice();
}
// check if the string is a valid float number (including integer)
if (!validator.isFloat(nstr)) {
var ret;
if (vType) {
ret = this.parseCoordinates(nstr, coordSys, vType);
}
if (ret) {
nstr = ret.toString();
unit = RegionValueUnit.DEGREE;
} else {
return null;
}
}
var val = parseFloat(nstr);
return {unit, val, isTransformationChecked};
}
var ops = option ? option : makeRegionOptions({});
const features = ptStr.split(/\s+/);
if (has(option, regionPropsList.PTTYPE)) {
unset(option, regionPropsList.PTTYPE);
}
if (has(option, regionPropsList.PTSIZE)) {
unset(option, regionPropsList.PTSIZE);
}
if (features.length >= 1) {
var pType = getRegionPointType(features[0]);
if ( pType && pType !== RegionPointType.undefined ) {
if (features.length === 1) {
set(ops, regionPropsList.PTTYPE, pType);
} else if (validator.isFloat(features[1])) {
var s;
if (pType === RegionPointType.arrow) {
s = parseInt(parseFloat(features[1])+0.5);
} else {
s = parseInt(parseFloat(features[1]) + 0.5) / 2;
}
set(ops, regionPropsList.PTSIZE, s);
set(ops, regionPropsList.PTTYPE, pType);
}
}
}
return ops;
}
export function fontHeight (fontSize) {
let height = 12;
if (validator.isFloat(fontSize.substring(0, fontSize.length-2))) {
height = parseFloat(fontSize.substring(0, fontSize.length-2)) * 14/10 + 0.5;
}
return height;
}
}
break;
case "numeric":
if (!this.isNumeric(text) && !validator.isNumeric(text)) {
is_valid = false;
}
break;
case "integer":
case "int":
if (!this.isNumeric(text) && !validator.isNumeric(text)) {
is_valid = false;
}
break;
case "real":
case "float":
if (!this.isNumeric(text) && !validator.isFloat(text)) {
is_valid = false;
}
break;
case "decimal":
if (!this.isNumeric(text) && !validator.isDecimal(text)) {
is_valid = false;
}
break;
case "alpha":
if (!validator.isAlpha(text)) {
is_valid = false;
}
break;
case "alphanumeric":
if (!validator.isAlphanumeric(text)) {
is_valid = false;
minMaxChecker(value, rules) {
if (validator.isInt(value)) {
return validator.isInt(value, rules)
} else if (validator.isFloat(value)) {
return validator.isFloat(value, rules)
}
}
}
break;
case "numeric":
if (!this.isNumeric(text) && !validator.isNumeric(text)) {
is_valid = false;
}
break;
case "integer":
case "int":
if (!this.isNumeric(text) && !validator.isNumeric(text)) {
is_valid = false;
}
break;
case "real":
case "float":
if (!this.isNumeric(text) && !validator.isFloat(text)) {
is_valid = false;
}
break;
case "decimal":
if (!this.isNumeric(text) && !validator.isDecimal(text)) {
is_valid = false;
}
break;
case "alpha":
if (!validator.isAlpha(text)) {
is_valid = false;
}
break;
case "alphanumeric":
if (!validator.isAlphanumeric(text)) {
is_valid = false;
float(value, options) {
return validator.isFloat(value, options);
},
ip(value, version) {