Files
aladin-lite/examples/al-moc-json.html
bmatthieu3 f656176e28 Fix MOC settings after its creation
MOC settings after their creation was not possible. This PR fix it.
It is also possible to directly set the 'color', 'fillColor', 'opacity'
and 'lineWidth' MOC properties without doing any reportChange
afterwards. These settings will automatically notify the wasm part for
change of the MOC options and will update the view.
2025-03-24 11:56:37 +01:00

39 lines
1.7 KiB
HTML

<!doctype html>
<html>
<head>
</head>
<body>
<div id="aladin-lite-div" style="width: 1024px; height: 768px">
<div id="ui" class="ui">
</div>
</div>
<script type="module">
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: 'LMC', fov: 55});
var json = {"3":[517],
"4":[2065,2066,2067,2112,2344,2346,2432],
"5":[8221,8257,8258,8259,8293,8304,8305,8307,8308,8452,8456,9346,9352,9354,9736],
"6":[32861,32862,32863,32881,32882,32883,32892,32893,33025,33026,33027,33157,33168,33169,33171,
33181,33224,33225,33227,33236,33240,33812,33816,33828,33832,37377,37378,37379,37382,37388,
37390,37412,37414,37420,37422,37562,38928,38930,38936,38948,38952],
"7":[131423,131439,131443,131523,131556,131557,131580,131581,132099,132612,132613,132624,132625,132627,132637,
132680,132681,132683,132709,132720,132721,132904,132905,132948,132952,132964,132968,133008,133009,133012,135252,135256,135268,135316,135320,135332,135336,148143,148152,148154,149507,149520
,149522,149523,149652,149654,149660,149662,149684,149686,149692,149694,149695,150120,150122,150208,150210,150216,150218,150240,150242,150243,155748,155752,155796,155800,155812,155816]};
//var json = {"3":[517],
//"4":[2065, 2067]};
var moc = A.MOCFromJSON(json, {opacity: 0.5, color: 'magenta', lineWidth: 1, fill: true});
aladin.addMOC(moc);
// Change the moc options after its creation
setTimeout(() => {
moc.opacity = 0.2
moc.fillColor = "orange"
}, 3000)
});
</script>
</body>
</html>