outils/OutilPunaiserAff.js

/*
 * Created by yvesb on 11/02/2017.
 */
/*
 * MathGraph32 Javascript : Software for animating online dynamic mathematics figures
 * https://www.mathgraph32.org/
 * @Author Yves Biton (yves.biton@sesamath.net)
 * @License: GNU AGPLv3 https://www.gnu.org/licenses/agpl-3.0.html
 */

import NatObj from '../types/NatObj'
import Outil from './Outil'
import AvertDlg from '../dialogs/AvertDlg'

export default OutilPunaiserAff
/**
 * Outil servant à marquer un point pour la trace
 * @param {MtgApp} app L'application propriétaire
 * @constructor
 */
function OutilPunaiserAff (app) {
  Outil.call(this, app, 'PunaiserAff', 32957, true)
}

OutilPunaiserAff.prototype = new Outil()

OutilPunaiserAff.prototype.select = function () {
  Outil.prototype.select.call(this)
  const app = this.app
  this.obj = null
  app.outilPointageActif = app.outilPointageObjetClignotant
  app.outilPointageActif.aDesigner = NatObj.NAffLieAPoint
  // On fait clignoter les points mobiles libres
  // app.listeClignotante.ajouteAffichagesVisibles(app.listePr, false)
  app.listeClignotante.addVisibleObjetsFixedOrNot(app.listePr, NatObj.NAffLieAPoint, false)
  app.outilPointageActif.reset(false, true) // Deuxième paramètre true pour pouvoir désigner un objet clignotant
  // même lorsqu'il est phase de masquage
  this.resetClignotement()
  app.indication('indPunAff')
}

OutilPunaiserAff.prototype.traiteObjetDesigne = function (elg) {
  const app = this.app
  elg.fixed = true
  new AvertDlg(app, 'ObPunaise')
  this.enleveDeClign(elg)
  this.saveFig()
}

OutilPunaiserAff.prototype.activationValide = function () {
  return this.app.listePr.nbVisibleObjectsFixedOrNot(NatObj.NAffLieAPoint, false) > 0
}