{"version":3,"sources":["https://lively-kernel.org/lively4/BP2019RH-stable/src/internal/individuals-as-points/venn/venn-diagram.js"],"names":["FORCE_CENTER_SIZE","FORCE_CENTER_COLOR","ForceCenterManager","IndividualsDistributor","IndividualsSimulation","InteractionManager","INDIVIDUALS_DOT_SIZE","THEME_GROUP_COLOR_TRANSPARENCY","VennDiagram","constructor","canvas","canvasContext","getContext","forceCenterManager","individualsDistributor","interactionManager","setDataProcessor","dataProcessor","_propagateDataProcessor","setColorStore","colorStore","_propagateColorStore","setCanvasExtent","newCanvasWidth","newCanvasHeight","initializeWithData","individuals","_stopSimulation","initialIndividuals","_preprocessIndividuals","_setupVisualization","addThemeGroup","uuid","name","themes","color","individualsSimulation","stop","_loadNewLayout","_updateInteractionSubjects","_registerForceCenterAnnotations","updateDistribution","updateThemeGroup","removeThemeGroup","recolorIndividuals","colorAction","runOn","filterIndividuals","filterAction","updateIndividuals","_individualsNotEmpty","selectIndividuals","selectAction","draw","_clearCanvas","_drawHulls","_drawForceCenters","_drawIndividuals","setDistribution","getForceCenters","updateForces","stopSimulation","length","_startLoadingAnimation","updateLayout","_endLoadingAnimation","loaderDiv","Object","assign","style","_getLoaderDivCSS","parentElement","appendChild","canvasRootElement","positionX","offsetLeft","offsetWidth","positionY","offsetTop","offsetHeight","border","borderTop","borderRadius","width","height","animation","position","left","top","removeChild","forEach","individual","drawing","currentSize","setInitialForceCenter","_setupIndividualsSimulation","_setupInteraction","start","registerDragging","registerToggle","registerDoubleClick","annotations","getForceCenterAnnotations","annotation","setDraggingSubjects","setToggleSubjects","clearRect","convertColorObjectToRGBAValue","currentColor","_drawPoint","x","y","forceCenter","getThemeGroups","themeGroup","groupHull","getGroupHull","_drawPolygon","getPaddedHullCornerPoints","getColor","size","fillStyle","beginPath","arc","Math","PI","fill","cornerPoints","moveTo","shift","point","lineTo","closePath"],"mappings":";;;;;;;;;;;;AAASA,uB,yBAAAA,iB;AAAmBC,wB,yBAAAA,kB;AAAoBC,wB,yBAAAA,k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D,WAHD;AAID;;AAEDV,mBAAWC,CAAX,EAAcC,CAAd,EAAiBS,IAAjB,EAAuBrF,KAAvB,EAA8B;AAC5B,eAAKxB,aAAL,CAAmB8G,SAAnB,GAA+BtF,KAA/B;AACA,eAAKxB,aAAL,CAAmB+G,SAAnB;AACA,eAAK/G,aAAL,CAAmBgH,GAAnB,CAAuBb,CAAvB,EAA0BC,CAA1B,EAA6BS,IAA7B,EAAmC,CAAnC,EAAsCI,KAAKC,EAAL,GAAU,CAAhD,EAAmD,IAAnD;AACA,eAAKlH,aAAL,CAAmBmH,IAAnB;AACD;;AAEDT,qBAAaU,YAAb,EAA2B5F,KAA3B,EAAkC;AAChC,eAAKxB,aAAL,CAAmB8G,SAAnB,GAA+BtF,KAA/B;AACA,eAAKxB,aAAL,CAAmB+G,SAAnB;AACA,eAAK/G,aAAL,CAAmBqH,MAAnB,CAA0BD,aAAa,CAAb,EAAgB,CAAhB,CAA1B,EAA8CA,aAAa,CAAb,EAAgB,CAAhB,CAA9C;AACAA,uBAAaE,KAAb;AACAF,uBAAarC,OAAb,CAAsBwC,KAAD,IAAW;AAC9B,iBAAKvH,aAAL,CAAmBwH,MAAnB,CAA0BD,MAAM,CAAN,CAA1B,EAAoCA,MAAM,CAAN,CAApC;AACD,WAFD;AAGA,eAAKvH,aAAL,CAAmByH,SAAnB;AACA,eAAKzH,aAAL,CAAmBmH,IAAnB;AACD;;AAvP8B;;yBAAZtH,W","file":"venn-diagram.js","sourcesContent":["import { FORCE_CENTER_SIZE, FORCE_CENTER_COLOR, ForceCenterManager } from \"./force-center-manager.js\"\nimport IndividualsDistributor from \"./individuals-distributor.js\"\nimport IndividualsSimulation from \"./individuals-simulation.js\"\nimport InteractionManager from \"./interaction-manager.js\"\n\nconst INDIVIDUALS_DOT_SIZE = 3\nexport const THEME_GROUP_COLOR_TRANSPARENCY = \"88\"\n\nexport default class VennDiagram {\n  \n  constructor(canvas) {\n    this.canvas = canvas\n    this.canvasContext = canvas.getContext(\"2d\")\n    this.forceCenterManager = new ForceCenterManager(canvas, this)\n    this.individualsDistributor = new IndividualsDistributor()\n    this.interactionManager = new InteractionManager(canvas, this)\n  }\n  \n  // ------------------------------------------\n  // Public Methods\n  // ------------------------------------------\n  \n  setDataProcessor(dataProcessor) {\n    this.dataProcessor = dataProcessor  \n    this._propagateDataProcessor()\n  }\n  \n  setColorStore(colorStore) {\n    this.colorStore = colorStore\n    this._propagateColorStore()\n  }\n  \n  setCanvasExtent(newCanvasWidth, newCanvasHeight) {\n    this.forceCenterManager.setCanvasExtent(newCanvasWidth, newCanvasHeight)\n  }\n  \n  async initializeWithData(individuals) {\n    this._stopSimulation()\n    this.individuals = individuals\n    this.initialIndividuals = individuals\n    this._preprocessIndividuals()\n    await this._setupVisualization()\n  }\n  \n  async addThemeGroup(uuid, name, themes, color) {\n    this.individualsSimulation.stop()\n    this.forceCenterManager.addThemeGroup(uuid, name, themes, color)\n    await this._loadNewLayout()\n    this._updateInteractionSubjects()\n    this._registerForceCenterAnnotations()\n    this.updateDistribution()\n  }\n  \n  updateThemeGroup(uuid, name, themes, color) {\n    this.forceCenterManager.updateThemeGroup(uuid, name, themes, color);\n    this.updateDistribution()\n  }\n  \n  async removeThemeGroup(uuid) {\n    this.individualsSimulation.stop()\n    this.forceCenterManager.removeThemeGroup(uuid)\n    await this._loadNewLayout()\n    this._updateInteractionSubjects()\n    this.updateDistribution()\n  }\n  \n  recolorIndividuals(colorAction) {\n    this._stopSimulation()\n    colorAction.runOn(this.individuals)\n    colorAction.runOn(this.initialIndividuals)\n    this.updateDistribution()\n  }\n  \n  filterIndividuals(filterAction) {\n    debugger;\n    this._stopSimulation()\n    this.individuals = filterAction.runOn(this.initialIndividuals)\n    this.individualsSimulation.updateIndividuals(this.individuals)\n    if(this._individualsNotEmpty()) {\n      this.updateDistribution()\n    }\n  }\n  \n  selectIndividuals(selectAction) {\n    this._stopSimulation()\n    selectAction.runOn(this.individuals)\n    this.updateDistribution()\n  }\n  \n  draw() {\n    this._clearCanvas()\n    this._drawHulls()\n    this._drawForceCenters()\n    this._drawIndividuals()\n  }\n  \n  updateDistribution() {\n    this.individualsDistributor.setDistribution(\n      this.individuals, this.forceCenterManager.getForceCenters())\n    this.individualsSimulation.updateForces()\n  }\n  \n  stopSimulation() {\n    if(this.individualsSimulation) this.individualsSimulation.stop()\n  }\n    \n  // ------------------------------------------\n  // Private Methods\n  // ------------------------------------------\n  \n  _individualsNotEmpty() {\n    return this.individuals.length\n  }\n  \n  _stopSimulation() {\n   if(this.individualsSimulation) {\n     this.individualsSimulation.stop()\n   }\n  }\n  \n  _propagateDataProcessor() {\n    //debugger;\n    this.forceCenterManager.setDataProcessor(this.dataProcessor)\n  }\n  \n  _propagateColorStore() {\n    this.forceCenterManager.setColorStore(this.colorStore)\n  }\n  \n  async _loadNewLayout() {\n    this._startLoadingAnimation()\n    await this.forceCenterManager.updateLayout()\n    this._endLoadingAnimation()\n  }\n  \n  _startLoadingAnimation() {\n    this.loaderDiv = <div class=\"loader\"></div>;\n    Object.assign(this.loaderDiv.style, this._getLoaderDivCSS())\n    this.canvas.parentElement.appendChild(this.loaderDiv)\n  }\n  \n  _getLoaderDivCSS() {\n    let canvasRootElement = this.canvas.parentElement\n    let positionX = canvasRootElement.offsetLeft + canvasRootElement.offsetWidth / 2;\n    let positionY = canvasRootElement.offsetTop + canvasRootElement.offsetHeight / 2;\n    return {\n      border: \"16px solid #f3f3f3\",\n      borderTop: \"16px solid #3498db\",\n      borderRadius: \"50%\",\n      width: \"80px\",\n      height: \"80px\",\n      animation: \"spin 2s linear infinite\",\n      position: \"absolute\",\n      left: positionX + \"px\",\n      top: positionY + \"px\"\n    }\n  }\n  \n  _endLoadingAnimation() {\n    this.canvas.parentElement.removeChild(this.loaderDiv)\n  }\n  \n  _preprocessIndividuals(){\n    this.individuals.forEach(individual => {\n      individual.drawing.currentSize = INDIVIDUALS_DOT_SIZE\n    })\n  }\n  \n  async _setupVisualization(){\n    this.forceCenterManager.setInitialForceCenter()\n    await this.forceCenterManager.updateLayout()\n    this.individualsDistributor.setDistribution(\n      this.individuals, \n      this.forceCenterManager.getForceCenters()\n    )\n    this._setupIndividualsSimulation(this.individuals)\n    this._setupInteraction()\n    this._registerForceCenterAnnotations()\n  }\n \n  _setupIndividualsSimulation(individuals) {\n    this.individualsSimulation = new IndividualsSimulation(this, individuals)\n    this.individualsSimulation.start()\n  }\n  \n  _setupInteraction() {\n    this.interactionManager.registerDragging(this.forceCenterManager.getForceCenters())\n    this.interactionManager.registerToggle(this.forceCenterManager.getForceCenters())\n    this.interactionManager.registerDoubleClick(this.forceCenterManager.getForceCenters())\n  }\n  \n  _registerForceCenterAnnotations() {\n    let annotations = this.forceCenterManager.getForceCenterAnnotations()\n    annotations.forEach( annotation => {\n      this.canvas.parentElement.appendChild(annotation)\n    })\n  }\n  \n  _updateInteractionSubjects() {\n    this.interactionManager.setDraggingSubjects(this.forceCenterManager.getForceCenters())\n    this.interactionManager.setToggleSubjects(this.forceCenterManager.getForceCenters())\n  }\n  \n  _clearCanvas() {\n    this.canvasContext.clearRect(0, 0, this.canvas.width, this.canvas.height);\n  }\n  \n  _drawIndividuals() {\n    this.individuals.forEach(individual => {\n      let color = this.colorStore.convertColorObjectToRGBAValue(\n        individual.drawing.currentColor)\n      this._drawPoint(\n        individual.x, \n        individual.y, \n        individual.drawing.currentSize, \n        color\n      )\n    })\n  }\n  \n  _drawForceCenters() {\n    this.forceCenterManager.getForceCenters().forEach(forceCenter => {\n      this._drawPoint(\n        forceCenter.x,\n        forceCenter.y,\n        FORCE_CENTER_SIZE,\n        FORCE_CENTER_COLOR\n      )\n    })\n  }\n  \n  _drawHulls() {\n    this.forceCenterManager.getThemeGroups().forEach(themeGroup => {\n      let groupHull = themeGroup.getGroupHull()\n      this._drawPolygon(groupHull.getPaddedHullCornerPoints(), themeGroup.getColor())\n    })\n  }\n  \n  _drawPoint(x, y, size, color) {\n    this.canvasContext.fillStyle = color;\n    this.canvasContext.beginPath();\n    this.canvasContext.arc(x, y, size, 0, Math.PI * 2, true);\n    this.canvasContext.fill();\n  }\n  \n  _drawPolygon(cornerPoints, color) {\n    this.canvasContext.fillStyle = color;\n    this.canvasContext.beginPath();\n    this.canvasContext.moveTo(cornerPoints[0][0], cornerPoints[0][1]);\n    cornerPoints.shift()\n    cornerPoints.forEach((point) => {\n      this.canvasContext.lineTo(point[0], point[1]);\n    })\n    this.canvasContext.closePath();\n    this.canvasContext.fill();\n  }\n  \n}"]}