Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit ab73e2b

Browse files
Woriepetetnt
authored andcommitted
Change parseInt to parseFloat everywhere where calculating box-model visualization to prevent glitches (#13353)
1 parent 23befa2 commit ab73e2b

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/LiveDevelopment/Agents/RemoteFunctions.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,17 @@ function RemoteFunctions(config, remoteWSPort) {
298298

299299
var borderBox = elementStyling.boxSizing === 'border-box';
300300

301-
var innerWidth = parseInt(elementStyling.width),
302-
innerHeight = parseInt(elementStyling.height),
301+
var innerWidth = parseFloat(elementStyling.width),
302+
innerHeight = parseFloat(elementStyling.height),
303303
outerHeight = innerHeight,
304304
outerWidth = innerWidth;
305305

306306
if (!borderBox) {
307-
innerWidth += parseInt(elementStyling.paddingLeft) + parseInt(elementStyling.paddingRight);
308-
innerHeight += parseInt(elementStyling.paddingTop) + parseInt(elementStyling.paddingBottom);
309-
outerWidth = innerWidth + parseInt(realElBorder.right) +
310-
parseInt(realElBorder.left),
311-
outerHeight = innerHeight + parseInt(realElBorder.bottom) + parseInt(realElBorder.top);
307+
innerWidth += parseFloat(elementStyling.paddingLeft) + parseFloat(elementStyling.paddingRight);
308+
innerHeight += parseFloat(elementStyling.paddingTop) + parseFloat(elementStyling.paddingBottom);
309+
outerWidth = innerWidth + parseFloat(realElBorder.right) +
310+
parseFloat(realElBorder.left),
311+
outerHeight = innerHeight + parseFloat(realElBorder.bottom) + parseFloat(realElBorder.top);
312312
}
313313

314314

@@ -326,7 +326,7 @@ function RemoteFunctions(config, remoteWSPort) {
326326
elStyling['top'] = 0;
327327

328328
if (borderBox) {
329-
elStyling['height'] = innerHeight - parseInt(realElBorder.top) - parseInt(realElBorder.bottom) + "px";
329+
elStyling['height'] = innerHeight - parseFloat(realElBorder.top) - parseFloat(realElBorder.bottom) + "px";
330330
}
331331

332332
} else {
@@ -335,7 +335,7 @@ function RemoteFunctions(config, remoteWSPort) {
335335
elStyling['left'] = 0;
336336

337337
if (borderBox) {
338-
elStyling['width'] = innerWidth - parseInt(realElBorder.left) - parseInt(realElBorder.right) + "px";
338+
elStyling['width'] = innerWidth - parseFloat(realElBorder.left) - parseFloat(realElBorder.right) + "px";
339339
}
340340
}
341341

@@ -349,23 +349,23 @@ function RemoteFunctions(config, remoteWSPort) {
349349
var elStyling = {};
350350

351351
var margin = [];
352-
margin['right'] = parseInt(elementStyling.getPropertyValue('margin-right'));
353-
margin['top'] = parseInt(elementStyling.getPropertyValue('margin-top'));
354-
margin['bottom'] = parseInt(elementStyling.getPropertyValue('margin-bottom'));
355-
margin['left'] = parseInt(elementStyling.getPropertyValue('margin-left'));
352+
margin['right'] = parseFloat(elementStyling.getPropertyValue('margin-right'));
353+
margin['top'] = parseFloat(elementStyling.getPropertyValue('margin-top'));
354+
margin['bottom'] = parseFloat(elementStyling.getPropertyValue('margin-bottom'));
355+
margin['left'] = parseFloat(elementStyling.getPropertyValue('margin-left'));
356356

357357
if(visualisations['horizontal'].indexOf(side) >= 0) {
358358

359359
elStyling['width'] = elementStyling.getPropertyValue('margin-' + side);
360360
elStyling['height'] = outerHeight + margin['top'] + margin['bottom'] + "px";
361-
elStyling['top'] = "-" + (margin['top'] + parseInt(realElBorder.top)) + "px";
361+
elStyling['top'] = "-" + (margin['top'] + parseFloat(realElBorder.top)) + "px";
362362
} else {
363363
elStyling['height'] = elementStyling.getPropertyValue('margin-' + side);
364364
elStyling['width'] = outerWidth + "px";
365365
elStyling['left'] = "-" + realElBorder.left;
366366
}
367367

368-
elStyling[side] = "-" + (margin[side] + parseInt(realElBorder[side])) + "px";
368+
elStyling[side] = "-" + (margin[side] + parseFloat(realElBorder[side])) + "px";
369369
elStyling['position'] = 'absolute';
370370

371371
return elStyling;

0 commit comments

Comments
 (0)