- Timestamp:
- 2019-05-16T20:07:59+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/map-scripts-editor.js
r33081 r33086 37 37 this.resizable = false; 38 38 this.dontResize = false; 39 39 40 this.shapeOptions = { 40 41 suppressUndo: true, … … 44 45 editable: true, 45 46 geodesic: false, 46 draggable: true 47 draggable: true, 48 description: "" 47 49 }; 48 50 this.mapEditorHistory = new MapEditorHistory(this); … … 85 87 86 88 thicknessSliderOutput.oninput = function () { 87 that.shapeSpecsChangeMD();89 that.shapeSpecsChangeMD(); // TODO: DO WE NEED THIS LINE? (LINE COPIED & PASTED FROM ABOVE) 88 90 if(this.value > that.MAX_THICKNESS) this.value = that.MAX_THICKNESS; 89 91 if(this.value < that.MIN_THICKNESS) this.value = that.MIN_THICKNESS; … … 107 109 } 108 110 opacitySliderOutput.oninput = function () { 109 that.shapeSpecsChange MD();111 that.shapeSpecsChangeOnInput(); 110 112 if(this.value > that.MAX_OPACITY) this.value = that.MAX_OPACITY; 111 113 if(this.value < that.MIN_OPACITY) this.value = that.MIN_OPACITY; … … 116 118 } 117 119 120 var descriptionInput = document.getElementById("description" + "-" + this.id); 121 descriptionInput.oninput = function () { 122 that.shapeSpecsChangeOnInput(); // takes care of history (undo/redo) 123 var description = this.value; 124 that.shapeOptions.description = description; 125 that.setSelectedDescription(that.shapeOptions.description); 126 } 127 128 // TODO: Do we need these listeners, when we already have onInput methods above? Test. 118 129 document.getElementById("color-palette1" + "-" + this.id).addEventListener("mousedown", function() { that.shapeSpecsChangeMD() }); 119 130 document.getElementById("thicknessRange" + "-" + this.id).addEventListener("mouseup", function () { that.shapeSpecsChangeMU() }); 120 document.getElementById("colourOpacity" + "-" + this.id).addEventListener("mouseup", function() { that.shapeSpecsChangeMU() } ); 131 document.getElementById("colourOpacity" + "-" + this.id).addEventListener("mouseup", function () { that.shapeSpecsChangeMU() }); 132 //document.getElementById("description" + "-" + this.id).addEventListener("keypress", function () { that.shapeSpecsChangeOnInput() }); 121 133 122 134 document.onmousedown = function (ev) { … … 214 226 } 215 227 228 MapEditor.prototype.shapeSpecsChangeOnInput = function () { 229 if (this.selectedShapes.length > 0) { 230 this.mapEditorHistory.presentOverlayPush(); 231 } 232 } 233 216 234 MapEditor.prototype.makeColorButton = function (color) { 217 235 var that = this; … … 332 350 // store reference to added overlay 333 351 google.maps.event.addListener(this.drawingManager, 'overlaycomplete', function (e) { 334 352 document.getElementById("description" + "-" + that.id).value = ""; 353 var value = document.getElementById("description" + "-" + that.id).value; 335 354 that.allowDeselect = true; 336 355 that.mapEditorHistory.historyOverlayPush(); 337 356 that.overlays.push(e.overlay); // store reference to added overlay 338 357 var newShape = e.overlay; 339 newShape.type = e.type; 358 newShape.type = e.type; 340 359 that.mapEditorHistory.presentOverlayPush(); 341 360 … … 389 408 //disable keyboard shortcut within the number input field 390 409 var activeElement = $(document.activeElement); 391 if(activeElement.attr('type') == 'number' ){410 if(activeElement.attr('type') == 'number' || activeElement.attr('type') == 'text'){ 392 411 //console.log('number detected') 393 412 return; … … 517 536 518 537 MapEditor.prototype.addShapeListeners = function (newShape, e) { 519 538 var that = this; 520 539 // Add an event listener that selects the newly-drawn shape when the user 521 540 // mouses down on it. … … 612 631 //Send the values to be updated 613 632 var thi = shape.strokeWeight; 614 var opa = shape.fillOpacity; 633 var opa = shape.fillOpacity; 615 634 var fCol = shape.fillColor; 616 635 var sCol = shape.strokeColor; 617 this.updateMenuValues(thi, opa, fCol, sCol); 636 var description = shape.description; 637 this.updateMenuValues(thi, opa, fCol, sCol, description); 618 638 619 639 } else if (shape.type == 'marker') { … … 636 656 } 637 657 658 //Set selected label 659 MapEditor.prototype.setSelectedDescription = function (label) { 660 if (this.selectedShapes.length > 0) { 661 for (var i = 0; i < this.selectedShapes.length; i++) { 662 this.selectedShapes[i].set('description', label); //SAME: this.selectedShapes[i].description = label; 663 } 664 } 665 } 666 638 667 //Set selected thickness 639 668 MapEditor.prototype.setSelectedThickness = function (sWeight) { … … 669 698 } 670 699 671 MapEditor.prototype.updateMenuValues = function (thi, opa, fCol, sCol ) {700 MapEditor.prototype.updateMenuValues = function (thi, opa, fCol, sCol, description) { 672 701 //Update thickness slider and value on the settings menu 673 702 var thicknessSliderOutput = document.getElementById("thicknessRangeVal" + "-" + this.id); … … 681 710 opacitySliderOutput.value = opa * 100; 682 711 document.getElementById("colourOpacity" + "-" + this.id).value = opa * 100; 712 713 // Show the description in the description field 714 var descriptionInput = document.getElementById("description" + "-" + this.id); 715 descriptionInput.value = description; 683 716 684 717 if (this.drawingManager.drawingMode == null) {
Note:
See TracChangeset
for help on using the changeset viewer.