Skip to content
Snippets Groups Projects
Select Git revision
  • a2be901803469d378d6469551a65c20f744aefff
  • experimental
  • master
  • v2021.1.2-ffs
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • v2020.2.3-ffs
  • nrbffs/fastd-remove-delay
  • v2020.2.2-ffs
  • v2020.2.1-ffs
  • v2020.2-ffs
  • v2020.2.x
  • v2020.1.3-ffs
  • v2020.1.1-ffs
  • v2020.1-ffs
  • v2019.1.2-ffs
  • v2019.1.1-ffs
  • nrb/test-radv-filter
  • v2019.1-ffs
  • nrbffs/netgear-ex6120
  • v2021.1.2-ffs0.2
  • v2021.1.2-ffs0.1
  • v2021.1.1-ffs0.4
  • v2021.1.1-ffs0.3
  • v2021.1.1-ffs0.2
  • v2021.1.1-ffs0.1
  • v2021.1-ffs0.1
  • v2020.2.3-ffs0.3
  • v2020.2.3-ffs0.2
  • v2020.2.3-ffs0.1
  • v2020.2.2-ffs0.1
  • v2020.2.1-ffs0.1
  • v2020.2-ffs0.1
  • v2020.2
  • v2020.2.x-ffs0.1
  • v2020.1.3-ffs0.1
  • v2020.1.1-ffs0.1
  • v2020.1-ffs0.1
  • v2019.1.2-ffs0.1
  • v2019.1.1-ffs0.1
41 results

getting_started.rst

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    labellayer.js 10.40 KiB
    define(['leaflet', 'rbush', 'helper', 'moment'],
      function (L, RBush, helper, moment) {
        'use strict';
    
        var groupOnline;
        var groupOffline;
        var groupNew;
        var groupLost;
        var groupLines;
    
        var labelLocations = [['left', 'middle', 0 / 8],
          ['center', 'top', 6 / 8],
          ['right', 'middle', 4 / 8],
          ['left', 'top', 7 / 8],
          ['left', 'ideographic', 1 / 8],
          ['right', 'top', 5 / 8],
          ['center', 'ideographic', 2 / 8],
          ['right', 'ideographic', 3 / 8]];
        var labelShadow;
        var bodyStyle = { fontFamily: 'sans-serif' };
        var nodeRadius = 4;
    
        var cFont = document.createElement('canvas').getContext('2d');
    
        function measureText(font, text) {
          cFont.font = font;
          return cFont.measureText(text);
        }
    
        function mapRTree(d) {
          return { minX: d.position.lat, minY: d.position.lng, maxX: d.position.lat, maxY: d.position.lng, label: d };
        }
    
        function prepareLabel(fillStyle, fontSize, offset, stroke) {
          return function (d) {
            var font = fontSize + 'px ' + bodyStyle.fontFamily;
            return {
              position: L.latLng(d.location.latitude, d.location.longitude),
              label: d.hostname,
              offset: offset,
              fillStyle: fillStyle,
              height: fontSize * 1.2,
              font: font,
              stroke: stroke,
              width: measureText(font, d.hostname).width
            };
          };
        }
    
        function calcOffset(offset, loc) {
          return [offset * Math.cos(loc[2] * 2 * Math.PI),
            offset * Math.sin(loc[2] * 2 * Math.PI)];
        }
    
        function labelRect(p, offset, anchor, label, minZoom, maxZoom, z) {
          var margin = 1 + 1.41 * (1 - (z - minZoom) / (maxZoom - minZoom));
    
          var width = label.width * margin;
          var height = label.height * margin;
    
          var dx = {
            left: 0,
            right: -width,
            center: -width / 2
          };
    
          var dy = {
            top: 0,
            ideographic: -height,
            middle: -height / 2