From 1ed2ee8e8c94aeb3dc8160d2d24e875e4b8328e9 Mon Sep 17 00:00:00 2001 From: Xelio Date: Sat, 16 Feb 2013 00:34:02 +0800 Subject: [PATCH] Performance tuning Merge multiple setStyle into one command --- code/map_data.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 2aa41259..d0b7476a 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -417,12 +417,12 @@ window.resonatorsResetStyle = function(portalGuid) { if(!resonatorLayerGroup) continue; resonatorLayerGroup.eachLayer(function(layer) { if (layer.options.guid) { - layer.setStyle({color: COLOR_NON_SELECTED_PORTAL_RESONATOR}); - layer.setStyle({radius: RADIUS_NON_SELECTED_PORTAL_RESONATOR}); - layer.setStyle({weight: WEIGHT_NON_SELECTED_PORTAL_RESONATOR}); + layer.setStyle({color: COLOR_NON_SELECTED_PORTAL_RESONATOR, + radius: RADIUS_NON_SELECTED_PORTAL_RESONATOR, + weight: WEIGHT_NON_SELECTED_PORTAL_RESONATOR}); } else { - layer.setStyle({opacity: OPACITY_NON_SELECTED_PORTAL_RESONATOR_LINE}); - layer.setStyle({weight: WEIGHT_NON_SELECTED_PORTAL_RESONATOR_LINE}); + layer.setStyle({opacity: OPACITY_NON_SELECTED_PORTAL_RESONATOR_LINE, + weight: WEIGHT_NON_SELECTED_PORTAL_RESONATOR_LINE}); } }); } @@ -434,12 +434,12 @@ window.resonatorsSetSelectStyle = function(portalGuid) { if(!resonatorLayerGroup) continue; resonatorLayerGroup.eachLayer(function(layer) { if (layer.options.guid) { - layer.bringToFront().setStyle({color: COLOR_SELECTED_PORTAL_RESONATOR}); - layer.setStyle({radius: RADIUS_SELECTED_PORTAL_RESONATOR}); - layer.setStyle({weight: WEIGHT_SELECTED_PORTAL_RESONATOR}); + layer.bringToFront().setStyle({color: COLOR_SELECTED_PORTAL_RESONATOR, + radius: RADIUS_SELECTED_PORTAL_RESONATOR, + weight: WEIGHT_SELECTED_PORTAL_RESONATOR}); } else { - layer.bringToFront().setStyle({opacity: OPACITY_SELECTED_PORTAL_RESONATOR_LINE}); - layer.setStyle({weight: WEIGHT_SELECTED_PORTAL_RESONATOR_LINE}); + layer.bringToFront().setStyle({opacity: OPACITY_SELECTED_PORTAL_RESONATOR_LINE, + weight: WEIGHT_SELECTED_PORTAL_RESONATOR_LINE}); } }); }