The repository contains a docker-compose file to assist with development. To begin, run docker compose up
to start the container. After it launches, you can visit http://localhost:4000 to access Leaflet Treering.
Simple variables use CamelCase naming convention. More complex variables or variables which relate to other variables use SnakeCase.
Descriptive variables names should be used along with comments explaining why code exists are required.
Example:
// Asset title in separate parts so title can be arranged in any order
var assetArea = 'CCS';
var assetNumber = '130';
var assetCode = 'A';
var asset_area_number_code = assestArea + assetNumber + assetCode;
Syntax:
function ThisThat ()
function hereThere ()
ThisThat.prototype.whoWhat = function ()
Functions which are used more than once or have the possibility to be reused in the future are located under Function Helper()
at the bottom.
Multi-line comments above them explaining purpose, function type, and inputs are required.
Example:
/**
* Calculate distance between two points
* @function distanceCalc
* @param {point A} - ptA
* @param {point B} - ptB
*/
function distanceCalc (ptA, ptB) {...}
Callback functions, located under LTreering, are used to connect all objects and methods. Most functions input 'Lt', short for LTreering, as their keyword to access object/methods from other areas of leaflet-treering.js.
Example:
function AssetAttributes (Lt) {
this.name = Lt.meta.assetName;
this.pointsIndex = Lt.data.index;
this.enableMeasurements = Lt.createPoint.enable();
}
All tools/features should be tested on multiple scenarios through at least Google Chrome, Mozilla FireFox, and Safari before merging to main.
Different scenarios are located in index_descriptor_descriptor .html files.
Current scenarios: