From 59b306d0cec5051776dd4081456665c7bd293230 Mon Sep 17 00:00:00 2001 From: Stefan Hanauska Date: Wed, 2 Aug 2023 10:06:55 +0200 Subject: [PATCH] Grunt --- amd/build/placestore.min.js | 2 +- amd/build/placestore.min.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amd/build/placestore.min.js b/amd/build/placestore.min.js index d9d872a..c712565 100644 --- a/amd/build/placestore.min.js +++ b/amd/build/placestore.min.js @@ -1,3 +1,3 @@ -define("mod_learningmap/placestore",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;let placestore={version:2023020801,id:0,places:[],paths:[],startingplaces:[],targetplaces:[],placecolor:"#c01c28",strokecolor:"#ffffff",strokeopacity:1,textcolor:"#ffffff",visitedcolor:"#26a269",height:100,width:800,hidepaths:!1,mapid:"",usecheckmark:!1,editmode:!0,pulse:!1,hover:!1,showall:!1,showtext:!1,slicemode:!1,showwaygone:!1,loadJSON:function(json){try{let fromjson=JSON.parse(json);null===fromjson.textcolor&&(fromjson.textcolor=fromjson.strokecolor),Object.assign(this,fromjson)}catch{}this.version=2023020801},buildJSON:function(){return JSON.stringify(this.getPlacestore())},addPlace:function(id,linkId){let linkedActivity=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.places.push({id:id,linkId:linkId,linkedActivity:linkedActivity,placecolor:null,visitedcolor:null}),1==this.places.length&&this.addStartingPlace(id),this.id++},removePlace:function(id){this.removeStartingPlace(id),this.removeTargetPlace(id),this.places=this.places.filter((function(p){return p.id!=id}))},addStartingPlace:function(id){this.startingplaces.push(id)},removeStartingPlace:function(id){this.startingplaces=this.startingplaces.filter((function(e){return e!=id}))},isStartingPlace:function(id){return this.startingplaces.includes(id)},addTargetPlace:function(id){this.targetplaces.push(id)},removeTargetPlace:function(id){this.targetplaces=this.targetplaces.filter((function(e){return e!=id}))},isTargetPlace:function(id){return this.targetplaces.includes(id)},addPath:function(pid,fid,sid){this.paths.push({id:pid,fid:fid,sid:sid,strokecolor:null,strokedasharray:null,hidepath:null})},removePath:function(id){this.paths=this.paths.filter((function(p){return p.id!=id}))},getTouchingPaths:function(id){return this.paths.filter((function(p){return p.fid==id||p.sid==id}))},getActivityId:function(id){let place=this.places.filter((function(e){return id==e.id}));return place.length>0?place[0].linkedActivity:null},setActivityId:function(id,linkedActivity){let place=this.places.filter((function(e){return id==e.id}));place.length>0&&(place[0].linkedActivity=linkedActivity)},setColor:function(type,color){switch(type){case"stroke":this.strokecolor=color;break;case"place":this.placecolor=color;break;case"visited":this.visitedcolor=color;break;case"text":this.textcolor=color}},getColor:function(type){switch(type){case"stroke":return this.strokecolor;case"place":return this.placecolor;case"visited":return this.visitedcolor;case"text":return this.textcolor}return null},getId:function(){return this.id},setBackgroundDimensions:function(width,height){this.width=width,this.height=height},getPathsWithFid:function(id){return this.paths.filter((function(p){return p.fid==id}))},getPathsWithSid:function(id){return this.paths.filter((function(p){return p.sid==id}))},getPlacestore:function(){return{id:this.id,places:this.places,paths:this.paths,startingplaces:this.startingplaces,targetplaces:this.targetplaces,placecolor:this.placecolor,strokecolor:this.strokecolor,strokeopacity:this.strokeopacity,textcolor:this.textcolor,visitedcolor:this.visitedcolor,height:this.height,width:this.width,hidepaths:this.hidepaths,mapid:this.mapid,usecheckmark:this.usecheckmark,editmode:this.editmode,version:this.version,pulse:this.pulse,hover:this.hover,showall:this.showall,showtext:this.showtext,slicemode:this.slicemode,showwaygone:this.showwaygone}},setHidePaths:function(value){this.hidepaths=value},getHidePaths:function(){return this.hidepaths},setPulse:function(value){this.pulse=value},getPulse:function(){return this.pulse},setHover:function(value){this.hover=value},getHover:function(){return this.hover},setShowall:function(value){this.showall=value},getShowall:function(){return this.showall},getMapid:function(){return this.mapid},getUseCheckmark:function(){return this.usecheckmark},setUseCheckmark:function(value){this.usecheckmark=value},getAllActivities:function(){let activities=[];return this.places.forEach((function(p){p.linkedActivity&&activities.push(p.linkedActivity)})),activities},setStrokeOpacity:function(value){this.strokeopacity=value},getStrokeOpacity:function(){return this.strokeopacity},setHideStroke:function(value){this.strokeopacity=value?0:1},getHideStroke:function(){return this.strokeopacity<1},getShowText:function(){return this.showtext},setShowText:function(value){this.showtext=value},getPlaces:function(){return this.places},getSliceMode:function(){return this.slicemode},setSliceMode:function(value){this.slicemode=value},getShowWayGone:function(){return this.showwaygone},setShowWayGone:function(value){this.showwaygone=value}};var _default=placestore;return _exports.default=_default,_exports.default})); +define("mod_learningmap/placestore",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;let placestore={version:2023080101,id:0,places:[],paths:[],startingplaces:[],targetplaces:[],placecolor:"#c01c28",strokecolor:"#ffffff",strokeopacity:1,textcolor:"#ffffff",visitedcolor:"#26a269",height:100,width:800,hidepaths:!1,mapid:"",usecheckmark:!1,editmode:!0,pulse:!1,hover:!1,showall:!1,showtext:!1,slicemode:!1,showwaygone:!1,loadJSON:function(json){try{let fromjson=JSON.parse(json);null===fromjson.textcolor&&(fromjson.textcolor=fromjson.strokecolor),Object.assign(this,fromjson)}catch{}this.version=2023080101},buildJSON:function(){return JSON.stringify(this.getPlacestore())},addPlace:function(id,linkId){let linkedActivity=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.places.push({id:id,linkId:linkId,linkedActivity:linkedActivity,placecolor:null,visitedcolor:null}),1==this.places.length&&this.addStartingPlace(id),this.id++},removePlace:function(id){this.removeStartingPlace(id),this.removeTargetPlace(id),this.places=this.places.filter((function(p){return p.id!=id}))},addStartingPlace:function(id){this.startingplaces.push(id)},removeStartingPlace:function(id){this.startingplaces=this.startingplaces.filter((function(e){return e!=id}))},isStartingPlace:function(id){return this.startingplaces.includes(id)},addTargetPlace:function(id){this.targetplaces.push(id)},removeTargetPlace:function(id){this.targetplaces=this.targetplaces.filter((function(e){return e!=id}))},isTargetPlace:function(id){return this.targetplaces.includes(id)},addPath:function(pid,fid,sid){this.paths.push({id:pid,fid:fid,sid:sid,strokecolor:null,strokedasharray:null,hidepath:null})},removePath:function(id){this.paths=this.paths.filter((function(p){return p.id!=id}))},getTouchingPaths:function(id){return this.paths.filter((function(p){return p.fid==id||p.sid==id}))},getActivityId:function(id){let place=this.places.filter((function(e){return id==e.id}));return place.length>0?place[0].linkedActivity:null},setActivityId:function(id,linkedActivity){let place=this.places.filter((function(e){return id==e.id}));place.length>0&&(place[0].linkedActivity=linkedActivity)},setColor:function(type,color){switch(type){case"stroke":this.strokecolor=color;break;case"place":this.placecolor=color;break;case"visited":this.visitedcolor=color;break;case"text":this.textcolor=color}},getColor:function(type){switch(type){case"stroke":return this.strokecolor;case"place":return this.placecolor;case"visited":return this.visitedcolor;case"text":return this.textcolor}return null},getId:function(){return this.id},setBackgroundDimensions:function(width,height){this.width=width,this.height=height},getPathsWithFid:function(id){return this.paths.filter((function(p){return p.fid==id}))},getPathsWithSid:function(id){return this.paths.filter((function(p){return p.sid==id}))},getPlacestore:function(){return{id:this.id,places:this.places,paths:this.paths,startingplaces:this.startingplaces,targetplaces:this.targetplaces,placecolor:this.placecolor,strokecolor:this.strokecolor,strokeopacity:this.strokeopacity,textcolor:this.textcolor,visitedcolor:this.visitedcolor,height:this.height,width:this.width,hidepaths:this.hidepaths,mapid:this.mapid,usecheckmark:this.usecheckmark,editmode:this.editmode,version:this.version,pulse:this.pulse,hover:this.hover,showall:this.showall,showtext:this.showtext,slicemode:this.slicemode,showwaygone:this.showwaygone}},setHidePaths:function(value){this.hidepaths=value},getHidePaths:function(){return this.hidepaths},setPulse:function(value){this.pulse=value},getPulse:function(){return this.pulse},setHover:function(value){this.hover=value},getHover:function(){return this.hover},setShowall:function(value){this.showall=value},getShowall:function(){return this.showall},getMapid:function(){return this.mapid},getUseCheckmark:function(){return this.usecheckmark},setUseCheckmark:function(value){this.usecheckmark=value},getAllActivities:function(){let activities=[];return this.places.forEach((function(p){p.linkedActivity&&activities.push(p.linkedActivity)})),activities},setStrokeOpacity:function(value){this.strokeopacity=value},getStrokeOpacity:function(){return this.strokeopacity},setHideStroke:function(value){this.strokeopacity=value?0:1},getHideStroke:function(){return this.strokeopacity<1},getShowText:function(){return this.showtext},setShowText:function(value){this.showtext=value},getPlaces:function(){return this.places},getSliceMode:function(){return this.slicemode},setSliceMode:function(value){this.slicemode=value},getShowWayGone:function(){return this.showwaygone},setShowWayGone:function(value){this.showwaygone=value}};var _default=placestore;return _exports.default=_default,_exports.default})); //# sourceMappingURL=placestore.min.js.map \ No newline at end of file diff --git a/amd/build/placestore.min.js.map b/amd/build/placestore.min.js.map index 03b98cf..1a8f50a 100644 --- a/amd/build/placestore.min.js.map +++ b/amd/build/placestore.min.js.map @@ -1 +1 @@ -{"version":3,"file":"placestore.min.js","sources":["../src/placestore.js"],"sourcesContent":["let placestore = {\n version: 2023020801,\n id: 0,\n places: [],\n paths: [],\n startingplaces: [],\n targetplaces: [],\n placecolor: '#c01c28',\n strokecolor: '#ffffff',\n strokeopacity: 1,\n textcolor: '#ffffff',\n visitedcolor: '#26a269',\n height: 100,\n width: 800,\n hidepaths: false,\n mapid: '',\n usecheckmark: false,\n editmode: true,\n pulse: false,\n hover: false,\n showall: false,\n showtext: false,\n slicemode: false,\n showwaygone: false,\n /**\n * Loads attributes from JSON into placestore\n * @param {*} json\n */\n loadJSON: function(json) {\n try {\n let fromjson = JSON.parse(json);\n if (fromjson.textcolor === null) {\n fromjson.textcolor = fromjson.strokecolor;\n }\n Object.assign(this, fromjson);\n // eslint-disable-next-line no-empty\n } catch { }\n // Update version (only relevant if learning map is saved)\n this.version = 2023020801;\n },\n /**\n * Returns placestore as a JSON string ()\n * @returns {string}\n */\n buildJSON: function() {\n return JSON.stringify(this.getPlacestore());\n },\n /**\n * Adds a place. If it is the only place, it is set as starting place\n * @param {*} id id of the place\n * @param {*} linkId id of the corresponding link\n * @param {*} linkedActivity course module id of linked activity\n */\n addPlace: function(id, linkId, linkedActivity = null) {\n this.places.push({\n id: id,\n linkId: linkId,\n linkedActivity: linkedActivity,\n placecolor: null,\n visitedcolor: null\n });\n if (this.places.length == 1) {\n this.addStartingPlace(id);\n }\n this.id++;\n },\n /**\n * Removes a place\n * @param {*} id id of the place\n */\n removePlace: function(id) {\n this.removeStartingPlace(id);\n this.removeTargetPlace(id);\n this.places = this.places.filter(\n function(p) {\n return p.id != id;\n }\n );\n },\n /**\n * Adds a place to the array of starting places\n * @param {*} id id of the place\n */\n addStartingPlace: function(id) {\n this.startingplaces.push(id);\n },\n /**\n * Removes a place from the array of starting places\n * @param {*} id id of the place\n */\n removeStartingPlace: function(id) {\n this.startingplaces = this.startingplaces.filter(\n function(e) {\n return e != id;\n }\n );\n },\n /**\n * Returns whether a place is in the array of starting places\n * @param {*} id id of the place\n * @returns {boolean}\n */\n isStartingPlace: function(id) {\n return this.startingplaces.includes(id);\n },\n /**\n * Adds a place to the array of target places\n * @param {*} id id of the place\n */\n addTargetPlace: function(id) {\n this.targetplaces.push(id);\n },\n /**\n * Removes a place from the array of target places\n * @param {*} id id of the place\n */\n removeTargetPlace: function(id) {\n this.targetplaces = this.targetplaces.filter(\n function(e) {\n return e != id;\n }\n );\n },\n /**\n * Returns whether a place is in the array of target places\n * @param {number} id id of the place\n * @returns {boolean}\n */\n isTargetPlace: function(id) {\n return this.targetplaces.includes(id);\n },\n /**\n * Adds a path between two places\n * @param {*} pid id of the path\n * @param {*} fid id of the first place\n * @param {*} sid id of the second place\n */\n addPath: function(pid, fid, sid) {\n this.paths.push({\n id: pid,\n fid: fid,\n sid: sid,\n strokecolor: null,\n strokedasharray: null,\n hidepath: null\n });\n },\n /**\n * Removes a path\n * @param {*} id id of the place\n */\n removePath: function(id) {\n this.paths = this.paths.filter(\n function(p) {\n return p.id != id;\n }\n );\n },\n /**\n * Returns an array of paths touching a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getTouchingPaths: function(id) {\n return this.paths.filter(\n function(p) {\n return p.fid == id || p.sid == id;\n }\n );\n },\n /**\n * Returns the course module id linked to a place\n * @param {*} id id of the place\n * @returns {number} id of the linked course module\n */\n getActivityId: function(id) {\n let place = this.places.filter(\n function(e) {\n return id == e.id;\n }\n );\n if (place.length > 0) {\n return place[0].linkedActivity;\n } else {\n return null;\n }\n },\n /**\n * Sets the id of the linked course module\n * @param {*} id id of the place\n * @param {*} linkedActivity course module id\n */\n setActivityId: function(id, linkedActivity) {\n let place = this.places.filter(\n function(e) {\n return id == e.id;\n }\n );\n if (place.length > 0) {\n place[0].linkedActivity = linkedActivity;\n }\n },\n /**\n * Sets the color of 'stroke', 'place' or 'visited'\n * @param {*} type type of the color\n * @param {*} color color in hex format\n */\n setColor: function(type, color) {\n switch (type) {\n case 'stroke':\n this.strokecolor = color;\n break;\n case 'place':\n this.placecolor = color;\n break;\n case 'visited':\n this.visitedcolor = color;\n break;\n case 'text':\n this.textcolor = color;\n break;\n }\n },\n /**\n * Gets the color of 'stroke', 'place' or 'visited'\n * @param {*} type type of the color\n * @returns {string} color in hex format\n */\n getColor: function(type) {\n switch (type) {\n case 'stroke':\n return this.strokecolor;\n case 'place':\n return this.placecolor;\n case 'visited':\n return this.visitedcolor;\n case 'text':\n return this.textcolor;\n }\n return null;\n },\n /**\n * Returns the current id\n * @returns {number}\n */\n getId: function() {\n return this.id;\n },\n /**\n * Sets the dimensions of the background image\n * @param {*} width\n * @param {*} height\n */\n setBackgroundDimensions: function(width, height) {\n this.width = width;\n this.height = height;\n },\n /**\n * Returns all paths starting at a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getPathsWithFid: function(id) {\n return this.paths.filter(function(p) {\n return p.fid == id;\n });\n },\n /**\n * Returns all paths ending at a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getPathsWithSid: function(id) {\n return this.paths.filter(function(p) {\n return p.sid == id;\n });\n },\n /**\n * Returns the attributes of placestore\n * @returns {object}\n */\n getPlacestore: function() {\n return {\n id: this.id,\n places: this.places,\n paths: this.paths,\n startingplaces: this.startingplaces,\n targetplaces: this.targetplaces,\n placecolor: this.placecolor,\n strokecolor: this.strokecolor,\n strokeopacity: this.strokeopacity,\n textcolor: this.textcolor,\n visitedcolor: this.visitedcolor,\n height: this.height,\n width: this.width,\n hidepaths: this.hidepaths,\n mapid: this.mapid,\n usecheckmark: this.usecheckmark,\n editmode: this.editmode,\n version: this.version,\n pulse: this.pulse,\n hover: this.hover,\n showall: this.showall,\n showtext: this.showtext,\n slicemode: this.slicemode,\n showwaygone: this.showwaygone,\n };\n },\n /**\n * Sets hidepaths attribute\n * @param {boolean} value\n */\n setHidePaths: function(value) {\n this.hidepaths = value;\n },\n /**\n * Returns the value of hidepaths attribute\n * @returns {boolean}\n */\n getHidePaths: function() {\n return this.hidepaths;\n },\n /**\n * Sets pulse attribute\n * @param {boolean} value\n */\n setPulse: function(value) {\n this.pulse = value;\n },\n /**\n * Returns the value of pulse attribute\n * @returns {boolean}\n */\n getPulse: function() {\n return this.pulse;\n },\n /**\n * Sets hover attribute\n * @param {boolean} value\n */\n setHover: function(value) {\n this.hover = value;\n },\n /**\n * Returns the value of hover attribute\n * @returns {boolean}\n */\n getHover: function() {\n return this.hover;\n },\n /**\n * Sets showall attribute\n * @param {boolean} value\n */\n setShowall: function(value) {\n this.showall = value;\n },\n /**\n * Returns the value of showall attribute\n * @returns {boolean}\n */\n getShowall: function() {\n return this.showall;\n },\n /**\n * Returns the mapid\n * @returns {string}\n */\n getMapid: function() {\n return this.mapid;\n },\n /**\n * Returns the value of usecheckmark attribute\n * @returns {boolean}\n */\n getUseCheckmark: function() {\n return this.usecheckmark;\n },\n /**\n * Sets the value of usecheckmark attribute\n * @param {boolean} value\n */\n setUseCheckmark: function(value) {\n this.usecheckmark = value;\n },\n /**\n * Returns an array with all activity ids\n * @returns {array}\n */\n getAllActivities: function() {\n let activities = [];\n this.places.forEach(function(p) {\n if (p.linkedActivity) {\n activities.push(p.linkedActivity);\n }\n });\n return activities;\n },\n /**\n * Sets stroke opacity\n * @param {number} value\n */\n setStrokeOpacity: function(value) {\n this.strokeopacity = value;\n },\n /**\n * Returns the current stroke opacity\n * @returns {number}\n */\n getStrokeOpacity: function() {\n return this.strokeopacity;\n },\n /**\n * Sets stroke opacity to 0\n * @param {number} value\n */\n setHideStroke: function(value) {\n this.strokeopacity = (value ? 0 : 1);\n },\n /**\n * Returns the current stroke opacity\n * @returns {number}\n */\n getHideStroke: function() {\n return this.strokeopacity < 1;\n },\n /**\n * Returns the value of showtext attribute\n * @returns {boolean}\n */\n getShowText: function() {\n return this.showtext;\n },\n /**\n * Sets the value of showtext attribute\n * @param {boolean} value\n */\n setShowText: function(value) {\n this.showtext = value;\n },\n /**\n * Returns an array with all place identifiers\n * @returns {array}\n */\n getPlaces: function() {\n return this.places;\n },\n /**\n * Returns if slicemode is enabled\n * @returns {boolean}\n */\n getSliceMode: function() {\n return this.slicemode;\n },\n /**\n * Sets state of slicemode\n * @param {boolean} value\n */\n setSliceMode: function(value) {\n this.slicemode = value;\n },\n /**\n * Returns if showwaygone is enabled\n * @returns {boolean}\n */\n getShowWayGone: function() {\n return this.showwaygone;\n },\n /**\n * Sets state of showwaygone\n * @param {boolean} value\n */\n setShowWayGone: function(value) {\n this.showwaygone = value;\n },\n};\n\nexport default placestore;\n"],"names":["placestore","version","id","places","paths","startingplaces","targetplaces","placecolor","strokecolor","strokeopacity","textcolor","visitedcolor","height","width","hidepaths","mapid","usecheckmark","editmode","pulse","hover","showall","showtext","slicemode","showwaygone","loadJSON","json","fromjson","JSON","parse","Object","assign","this","buildJSON","stringify","getPlacestore","addPlace","linkId","linkedActivity","push","length","addStartingPlace","removePlace","removeStartingPlace","removeTargetPlace","filter","p","e","isStartingPlace","includes","addTargetPlace","isTargetPlace","addPath","pid","fid","sid","strokedasharray","hidepath","removePath","getTouchingPaths","getActivityId","place","setActivityId","setColor","type","color","getColor","getId","setBackgroundDimensions","getPathsWithFid","getPathsWithSid","setHidePaths","value","getHidePaths","setPulse","getPulse","setHover","getHover","setShowall","getShowall","getMapid","getUseCheckmark","setUseCheckmark","getAllActivities","activities","forEach","setStrokeOpacity","getStrokeOpacity","setHideStroke","getHideStroke","getShowText","setShowText","getPlaces","getSliceMode","setSliceMode","getShowWayGone","setShowWayGone"],"mappings":"wJAAIA,WAAa,CACbC,QAAS,WACTC,GAAI,EACJC,OAAQ,GACRC,MAAO,GACPC,eAAgB,GAChBC,aAAc,GACdC,WAAY,UACZC,YAAa,UACbC,cAAe,EACfC,UAAW,UACXC,aAAc,UACdC,OAAQ,IACRC,MAAO,IACPC,WAAW,EACXC,MAAO,GACPC,cAAc,EACdC,UAAU,EACVC,OAAO,EACPC,OAAO,EACPC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,aAAa,EAKbC,SAAU,SAASC,cAEPC,SAAWC,KAAKC,MAAMH,MACC,OAAvBC,SAAShB,YACTgB,SAAShB,UAAYgB,SAASlB,aAElCqB,OAAOC,OAAOC,KAAML,UAEtB,YAEGzB,QAAU,YAMnB+B,UAAW,kBACAL,KAAKM,UAAUF,KAAKG,kBAQ/BC,SAAU,SAASjC,GAAIkC,YAAQC,sEAAiB,UACvClC,OAAOmC,KAAK,CACbpC,GAAIA,GACJkC,OAAQA,OACRC,eAAgBA,eAChB9B,WAAY,KACZI,aAAc,OAEQ,GAAtBoB,KAAK5B,OAAOoC,aACPC,iBAAiBtC,SAErBA,MAMTuC,YAAa,SAASvC,SACbwC,oBAAoBxC,SACpByC,kBAAkBzC,SAClBC,OAAS4B,KAAK5B,OAAOyC,QACtB,SAASC,UACEA,EAAE3C,IAAMA,OAQ3BsC,iBAAkB,SAAStC,SAClBG,eAAeiC,KAAKpC,KAM7BwC,oBAAqB,SAASxC,SACrBG,eAAiB0B,KAAK1B,eAAeuC,QACtC,SAASE,UACEA,GAAK5C,OASxB6C,gBAAiB,SAAS7C,WACf6B,KAAK1B,eAAe2C,SAAS9C,KAMxC+C,eAAgB,SAAS/C,SAChBI,aAAagC,KAAKpC,KAM3ByC,kBAAmB,SAASzC,SACnBI,aAAeyB,KAAKzB,aAAasC,QAClC,SAASE,UACEA,GAAK5C,OASxBgD,cAAe,SAAShD,WACb6B,KAAK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,QAMhByF,aAAc,kBACH7D,KAAKT,WAMhBuE,aAAc,SAAStB,YACdjD,UAAYiD,OAMrBuB,eAAgB,kBACL/D,KAAKR,aAMhBwE,eAAgB,SAASxB,YAChBhD,YAAcgD,qBAIZvE"} \ No newline at end of file +{"version":3,"file":"placestore.min.js","sources":["../src/placestore.js"],"sourcesContent":["let placestore = {\n version: 2023080101,\n id: 0,\n places: [],\n paths: [],\n startingplaces: [],\n targetplaces: [],\n placecolor: '#c01c28',\n strokecolor: '#ffffff',\n strokeopacity: 1,\n textcolor: '#ffffff',\n visitedcolor: '#26a269',\n height: 100,\n width: 800,\n hidepaths: false,\n mapid: '',\n usecheckmark: false,\n editmode: true,\n pulse: false,\n hover: false,\n showall: false,\n showtext: false,\n slicemode: false,\n showwaygone: false,\n /**\n * Loads attributes from JSON into placestore\n * @param {*} json\n */\n loadJSON: function(json) {\n try {\n let fromjson = JSON.parse(json);\n if (fromjson.textcolor === null) {\n fromjson.textcolor = fromjson.strokecolor;\n }\n Object.assign(this, fromjson);\n // eslint-disable-next-line no-empty\n } catch { }\n // Update version (only relevant if learning map is saved)\n this.version = 2023080101;\n },\n /**\n * Returns placestore as a JSON string ()\n * @returns {string}\n */\n buildJSON: function() {\n return JSON.stringify(this.getPlacestore());\n },\n /**\n * Adds a place. If it is the only place, it is set as starting place\n * @param {*} id id of the place\n * @param {*} linkId id of the corresponding link\n * @param {*} linkedActivity course module id of linked activity\n */\n addPlace: function(id, linkId, linkedActivity = null) {\n this.places.push({\n id: id,\n linkId: linkId,\n linkedActivity: linkedActivity,\n placecolor: null,\n visitedcolor: null\n });\n if (this.places.length == 1) {\n this.addStartingPlace(id);\n }\n this.id++;\n },\n /**\n * Removes a place\n * @param {*} id id of the place\n */\n removePlace: function(id) {\n this.removeStartingPlace(id);\n this.removeTargetPlace(id);\n this.places = this.places.filter(\n function(p) {\n return p.id != id;\n }\n );\n },\n /**\n * Adds a place to the array of starting places\n * @param {*} id id of the place\n */\n addStartingPlace: function(id) {\n this.startingplaces.push(id);\n },\n /**\n * Removes a place from the array of starting places\n * @param {*} id id of the place\n */\n removeStartingPlace: function(id) {\n this.startingplaces = this.startingplaces.filter(\n function(e) {\n return e != id;\n }\n );\n },\n /**\n * Returns whether a place is in the array of starting places\n * @param {*} id id of the place\n * @returns {boolean}\n */\n isStartingPlace: function(id) {\n return this.startingplaces.includes(id);\n },\n /**\n * Adds a place to the array of target places\n * @param {*} id id of the place\n */\n addTargetPlace: function(id) {\n this.targetplaces.push(id);\n },\n /**\n * Removes a place from the array of target places\n * @param {*} id id of the place\n */\n removeTargetPlace: function(id) {\n this.targetplaces = this.targetplaces.filter(\n function(e) {\n return e != id;\n }\n );\n },\n /**\n * Returns whether a place is in the array of target places\n * @param {number} id id of the place\n * @returns {boolean}\n */\n isTargetPlace: function(id) {\n return this.targetplaces.includes(id);\n },\n /**\n * Adds a path between two places\n * @param {*} pid id of the path\n * @param {*} fid id of the first place\n * @param {*} sid id of the second place\n */\n addPath: function(pid, fid, sid) {\n this.paths.push({\n id: pid,\n fid: fid,\n sid: sid,\n strokecolor: null,\n strokedasharray: null,\n hidepath: null\n });\n },\n /**\n * Removes a path\n * @param {*} id id of the place\n */\n removePath: function(id) {\n this.paths = this.paths.filter(\n function(p) {\n return p.id != id;\n }\n );\n },\n /**\n * Returns an array of paths touching a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getTouchingPaths: function(id) {\n return this.paths.filter(\n function(p) {\n return p.fid == id || p.sid == id;\n }\n );\n },\n /**\n * Returns the course module id linked to a place\n * @param {*} id id of the place\n * @returns {number} id of the linked course module\n */\n getActivityId: function(id) {\n let place = this.places.filter(\n function(e) {\n return id == e.id;\n }\n );\n if (place.length > 0) {\n return place[0].linkedActivity;\n } else {\n return null;\n }\n },\n /**\n * Sets the id of the linked course module\n * @param {*} id id of the place\n * @param {*} linkedActivity course module id\n */\n setActivityId: function(id, linkedActivity) {\n let place = this.places.filter(\n function(e) {\n return id == e.id;\n }\n );\n if (place.length > 0) {\n place[0].linkedActivity = linkedActivity;\n }\n },\n /**\n * Sets the color of 'stroke', 'place' or 'visited'\n * @param {*} type type of the color\n * @param {*} color color in hex format\n */\n setColor: function(type, color) {\n switch (type) {\n case 'stroke':\n this.strokecolor = color;\n break;\n case 'place':\n this.placecolor = color;\n break;\n case 'visited':\n this.visitedcolor = color;\n break;\n case 'text':\n this.textcolor = color;\n break;\n }\n },\n /**\n * Gets the color of 'stroke', 'place' or 'visited'\n * @param {*} type type of the color\n * @returns {string} color in hex format\n */\n getColor: function(type) {\n switch (type) {\n case 'stroke':\n return this.strokecolor;\n case 'place':\n return this.placecolor;\n case 'visited':\n return this.visitedcolor;\n case 'text':\n return this.textcolor;\n }\n return null;\n },\n /**\n * Returns the current id\n * @returns {number}\n */\n getId: function() {\n return this.id;\n },\n /**\n * Sets the dimensions of the background image\n * @param {*} width\n * @param {*} height\n */\n setBackgroundDimensions: function(width, height) {\n this.width = width;\n this.height = height;\n },\n /**\n * Returns all paths starting at a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getPathsWithFid: function(id) {\n return this.paths.filter(function(p) {\n return p.fid == id;\n });\n },\n /**\n * Returns all paths ending at a place\n * @param {*} id id of the place\n * @returns {array}\n */\n getPathsWithSid: function(id) {\n return this.paths.filter(function(p) {\n return p.sid == id;\n });\n },\n /**\n * Returns the attributes of placestore\n * @returns {object}\n */\n getPlacestore: function() {\n return {\n id: this.id,\n places: this.places,\n paths: this.paths,\n startingplaces: this.startingplaces,\n targetplaces: this.targetplaces,\n placecolor: this.placecolor,\n strokecolor: this.strokecolor,\n strokeopacity: this.strokeopacity,\n textcolor: this.textcolor,\n visitedcolor: this.visitedcolor,\n height: this.height,\n width: this.width,\n hidepaths: this.hidepaths,\n mapid: this.mapid,\n usecheckmark: this.usecheckmark,\n editmode: this.editmode,\n version: this.version,\n pulse: this.pulse,\n hover: this.hover,\n showall: this.showall,\n showtext: this.showtext,\n slicemode: this.slicemode,\n showwaygone: this.showwaygone,\n };\n },\n /**\n * Sets hidepaths attribute\n * @param {boolean} value\n */\n setHidePaths: function(value) {\n this.hidepaths = value;\n },\n /**\n * Returns the value of hidepaths attribute\n * @returns {boolean}\n */\n getHidePaths: function() {\n return this.hidepaths;\n },\n /**\n * Sets pulse attribute\n * @param {boolean} value\n */\n setPulse: function(value) {\n this.pulse = value;\n },\n /**\n * Returns the value of pulse attribute\n * @returns {boolean}\n */\n getPulse: function() {\n return this.pulse;\n },\n /**\n * Sets hover attribute\n * @param {boolean} value\n */\n setHover: function(value) {\n this.hover = value;\n },\n /**\n * Returns the value of hover attribute\n * @returns {boolean}\n */\n getHover: function() {\n return this.hover;\n },\n /**\n * Sets showall attribute\n * @param {boolean} value\n */\n setShowall: function(value) {\n this.showall = value;\n },\n /**\n * Returns the value of showall attribute\n * @returns {boolean}\n */\n getShowall: function() {\n return this.showall;\n },\n /**\n * Returns the mapid\n * @returns {string}\n */\n getMapid: function() {\n return this.mapid;\n },\n /**\n * Returns the value of usecheckmark attribute\n * @returns {boolean}\n */\n getUseCheckmark: function() {\n return this.usecheckmark;\n },\n /**\n * Sets the value of usecheckmark attribute\n * @param {boolean} value\n */\n setUseCheckmark: function(value) {\n this.usecheckmark = value;\n },\n /**\n * Returns an array with all activity ids\n * @returns {array}\n */\n getAllActivities: function() {\n let activities = [];\n this.places.forEach(function(p) {\n if (p.linkedActivity) {\n activities.push(p.linkedActivity);\n }\n });\n return activities;\n },\n /**\n * Sets stroke opacity\n * @param {number} value\n */\n setStrokeOpacity: function(value) {\n this.strokeopacity = value;\n },\n /**\n * Returns the current stroke opacity\n * @returns {number}\n */\n getStrokeOpacity: function() {\n return this.strokeopacity;\n },\n /**\n * Sets stroke opacity to 0\n * @param {number} value\n */\n setHideStroke: function(value) {\n this.strokeopacity = (value ? 0 : 1);\n },\n /**\n * Returns the current stroke opacity\n * @returns {number}\n */\n getHideStroke: function() {\n return this.strokeopacity < 1;\n },\n /**\n * Returns the value of showtext attribute\n * @returns {boolean}\n */\n getShowText: function() {\n return this.showtext;\n },\n /**\n * Sets the value of showtext attribute\n * @param {boolean} value\n */\n setShowText: function(value) {\n this.showtext = value;\n },\n /**\n * Returns an array with all place identifiers\n * @returns {array}\n */\n getPlaces: function() {\n return this.places;\n },\n /**\n * Returns if slicemode is enabled\n * @returns {boolean}\n */\n getSliceMode: function() {\n return this.slicemode;\n },\n /**\n * Sets state of slicemode\n * @param {boolean} value\n */\n setSliceMode: function(value) {\n this.slicemode = value;\n },\n /**\n * Returns if showwaygone is enabled\n * @returns {boolean}\n */\n getShowWayGone: function() {\n return this.showwaygone;\n },\n /**\n * Sets state of showwaygone\n * @param {boolean} value\n */\n setShowWayGone: function(value) {\n this.showwaygone = value;\n },\n};\n\nexport default placestore;\n"],"names":["placestore","version","id","places","paths","startingplaces","targetplaces","placecolor","strokecolor","strokeopacity","textcolor","visitedcolor","height","width","hidepaths","mapid","usecheckmark","editmode","pulse","hover","showall","showtext","slicemode","showwaygone","loadJSON","json","fromjson","JSON","parse","Object","assign","this","buildJSON","stringify","getPlacestore","addPlace","linkId","linkedActivity","push","length","addStartingPlace","removePlace","removeStartingPlace","removeTargetPlace","filter","p","e","isStartingPlace","includes","addTargetPlace","isTargetPlace","addPath","pid","fid","sid","strokedasharray","hidepath","removePath","getTouchingPaths","getActivityId","place","setActivityId","setColor","type","color","getColor","getId","setBackgroundDimensions","getPathsWithFid","getPathsWithSid","setHidePaths","value","getHidePaths","setPulse","getPulse","setHover","getHover","setShowall","getShowall","getMapid","getUseCheckmark","setUseCheckmark","getAllActivities","activities","forEach","setStrokeOpacity","getStrokeOpacity","setHideStroke","getHideStroke","getShowText","setShowText","getPlaces","getSliceMode","setSliceMode","getShowWayGone","setShowWayGone"],"mappings":"wJAAIA,WAAa,CACbC,QAAS,WACTC,GAAI,EACJC,OAAQ,GACRC,MAAO,GACPC,eAAgB,GAChBC,aAAc,GACdC,WAAY,UACZC,YAAa,UACbC,cAAe,EACfC,UAAW,UACXC,aAAc,UACdC,OAAQ,IACRC,MAA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