1540 Change innerHTML to value to sync user input

This commit is contained in:
zero41120 2020-02-06 13:50:15 -08:00
parent 2d971af445
commit 94183f7f18

View File

@ -79,7 +79,7 @@
// Load default examples
function loadExample(){
polygonList = JSON.parse(JSON.stringify(examples));
previewEl.innerHTML = JSON.stringify(polygonList);
previewEl.value = JSON.stringify(polygonList);
}
loadExample();
@ -91,7 +91,7 @@
p.x = Math.round((p.x + Number.EPSILON) * 100) / 100
p.y = Math.round((p.y + Number.EPSILON) * 100) / 100
polygon.push([p.x, p.y]);
polygonEl.innerHTML += '['+p.x+','+ p.y+']';
polygonEl.value += '['+p.x+','+ p.y+']';
});
// Add clicked points to polygon tracker variable
@ -99,13 +99,13 @@
if (polygon.length == 0) { return; }
polygonList.push(polygon);
polygon = [];
polygonEl.innerHTML = '';
previewEl.innerHTML = JSON.stringify(polygonList);
polygonEl.value = '';
previewEl.value = JSON.stringify(polygonList);
};
document.getElementById('cropBtn').onclick = function(){
polygonList = JSON.parse(previewEl.innerHTML);
polygonEl.innerHTML = '';
polygonList = JSON.parse(previewEl.value);
polygonEl.value = '';
var tiledImage = viewer.world.getItemAt(0);
tiledImage.setCroppingPolygons(polygonList);
viewer.forceRedraw();
@ -114,8 +114,8 @@
document.getElementById('resetBtn').onclick = function(){
polygonList = []
polygon = []
polygonEl.innerHTML = '';
previewEl.innerHTML = '';
polygonEl.value = '';
previewEl.value = '';
var tiledImage = viewer.world.getItemAt(0);
tiledImage.resetCroppingPolygons();
viewer.forceRedraw();