Currently, I am developing an application that involves dragging an image using Jquery's draggable utility. The image is accompanied by several overlay divs containing various components positioned based on pixel locations, sometimes reaching into the thousands.
Has anyone conducted performance tests to compare dragging all these elements simultaneously versus just the image and then re-rendering the rest post-drag?
I am leaning towards the latter method but would appreciate additional insights if available.
After careful consideration, I opted for a single svg layer with the Jquery draggable utility enabled
$("#zones_imageSVG").draggable( "enable" );
, which contains multiple rectangles and circles. This setup allows smooth dragging of the svg layer without any lag or interruptions, providing a solution that bypasses the need for multiple div layers.
<svg id="zones_imageSVG" class="moveCursor" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" height="430" width="549.4444444444445" style="position: relative;">
<image id="zones_image" width="549.4444444444445" height="430" y="0" x="0" xlink:href="./images/testCampus1_HQ_floorA.jpg">
<circle id="icon_sensor0" class="handle_svgAttrCirc" cx="91.63777777777779" cy="287.14444444444445" r="1.9111111111111112" fill="red">
<circle id="icon_sensor1" class="handle_svgAttrCirc" cx="272.0466666666667" cy="332.9155555555556" r="1.9111111111111112" fill="red">
<circle id="icon_sensor2" class="handle_svgAttrCirc" cx="412.60888888888894" cy="221.40222222222224" r="1.9111111111111112" fill="red">
<circle id="icon_sensor3" class="handle_svgAttrCirc" cx="410.3155555555556" cy="103.8688888888889" r="1.9111111111111112" fill="red">
<rect id="idAttrRect0" class="handle_svgAttrRect" x="512.1777777777778" y="73.38666666666667" height="74" width="88" fill="#3196bd">
<rect id="idAttrRect1" class="handle_svgAttrRect" x="416.62222222222226" y="54.27555555555556" height="54" width="48" fill="#3196bd">
<rect id="idAttrRect2" class="handle_svgAttrRect" x="321.0666666666667" y="25.60888888888889" height="24" width="38" fill="#3196bd">
<rect id="idAttrRect3" class="handle_svgAttrRect" x="129.95555555555558" y="44.720000000000006" height="44" width="44" fill="#DC143C">
<rect id="idAttrRect4" class="handle_svgAttrRect" x="416.62222222222226" y="35.16444444444445" height="84" width="38" fill="#A1DC14">
</svg>