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

Commit

Permalink
Formatting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Połowniak committed Mar 24, 2017
1 parent 24b2e6b commit 12b882d
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions src/LiveDevelopment/Agents/RemoteFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ function RemoteFunctions(config, remoteWSPort) {
experimental = config.experimental;
}
var lastKeepAliveTime = Date.now();
var req, timeout;
var animateHighlight = function (time) {
if(req) {
window.cancelAnimationFrame(req);
window.clearTimeout(timeout);
}
req = window.requestAnimationFrame(redrawHighlights);

timeout = setTimeout(function () {
window.cancelAnimationFrame(req);
req = null;
}, time * 1000);
};
var req, timeout;
var animateHighlight = function (time) {
if(req) {
window.cancelAnimationFrame(req);
window.clearTimeout(timeout);
}
req = window.requestAnimationFrame(redrawHighlights);

timeout = setTimeout(function () {
window.cancelAnimationFrame(req);
req = null;
}, time * 1000);
};

/**
* @type {DOMEditHandler}
Expand Down Expand Up @@ -290,23 +290,24 @@ function RemoteFunctions(config, remoteWSPort) {
}

var realElBorder = {
"right": elementStyling.getPropertyValue('border-right-width'),
"left": elementStyling.getPropertyValue('border-left-width'),
"top": elementStyling.getPropertyValue('border-top-width'),
"bottom": elementStyling.getPropertyValue('border-bottom-width'),
right: elementStyling.getPropertyValue('border-right-width'),
left: elementStyling.getPropertyValue('border-left-width'),
top: elementStyling.getPropertyValue('border-top-width'),
bottom: elementStyling.getPropertyValue('border-bottom-width')
};

var innerWidth = elementBounds.width - parseInt(realElBorder.left) - parseInt(realElBorder.right);
var innerHeight = elementBounds.height - parseInt(realElBorder.top) - parseInt(realElBorder.bottom);

var visualisations = [];
visualisations['horizontal'] = "left, right";
visualisations['vertical'] = "top, bottom";
var visualisations = {
horizontal: "left, right",
vertical: "top, bottom"
};

var drawPaddingRect = function(side) {
var elStyling = {};

if(visualisations['horizontal'].indexOf(side) >= 0) {
if (visualisations.horizontal.indexOf(side) >= 0) {
elStyling['width'] = elementStyling.getPropertyValue('padding-' + side);
elStyling['height'] = innerHeight + "px";
elStyling['top'] = realElBorder.top;
Expand All @@ -326,7 +327,7 @@ function RemoteFunctions(config, remoteWSPort) {
var drawMarginRect = function(side) {
var elStyling = {};

var margin = [];
var margin = [];
margin['right'] = parseInt(elementStyling.getPropertyValue('margin-right'));
margin['top'] = parseInt(elementStyling.getPropertyValue('margin-top'));
margin['bottom'] = parseInt(elementStyling.getPropertyValue('margin-bottom'));
Expand Down Expand Up @@ -363,7 +364,7 @@ function RemoteFunctions(config, remoteWSPort) {
};

var mainBoxStyles = config.remoteHighlight.stylesToSet;
mainBoxStyles['border'] = 'none';
mainBoxStyles['border'] = 'none';

var paddingVisualisations = [
drawPaddingRect('top'),
Expand Down Expand Up @@ -394,10 +395,7 @@ function RemoteFunctions(config, remoteWSPort) {
arr[i]
);

_setStyleValues(
styles,
el.style
);
_setStyleValues(styles, el.style);

highlight.appendChild(el);
}
Expand Down

0 comments on commit 12b882d

Please sign in to comment.