ZjMarker.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const app = getApp();
  2. export class zjMarker {
  3. constructor(longitude, latitude, id, options = {}) {
  4. // console.log(options)
  5. this.longitude = longitude;
  6. this.latitude = latitude;
  7. this.id = id;
  8. this.width = options.width ? options.width : 28;
  9. this.height = options.height != undefined ? options.height : 28;
  10. let type = options.type == undefined ? 'single' : options.type;
  11. this.iconPath = options.iconPath == undefined ? '/img/markerIcon.png' : options.iconPath;
  12. if (type != 'single') {
  13. if (options.num == '') {
  14. // console.log(options.num, 'chechk success');
  15. }
  16. if (app.systemInfo.platform == 'ios') {
  17. this.label = {
  18. content: options.num + '',
  19. color: "#000000",
  20. fontSize: 14,
  21. borderWidth: 0,
  22. borderRadius: 0,
  23. bgColor: "#00FFFF00",
  24. padding: 0,
  25. textAlign: 'center',
  26. anchorY: -25,
  27. anchorX: options.num >= 10 ? 0 : 0,
  28. display: "ALWAYS"
  29. };
  30. } else {
  31. this.callout = {
  32. content: options.num + '',
  33. color: '#000',
  34. borderRadius: 3,
  35. borderWidth: 0,
  36. bgColor: '#00FFFF00',
  37. padding: 0,
  38. display: 'ALWAYS',
  39. textAlign: 'center',
  40. anchorY: 55
  41. }
  42. }
  43. }
  44. this.setCheckStatus(options.isSelect);
  45. }
  46. setCheckStatus(isCheck) {
  47. if (isCheck == undefined)
  48. return;
  49. if (isCheck) {
  50. this.width = 28;
  51. this.height = 28;
  52. } else {
  53. this.width = 28;
  54. this.height = 28;
  55. }
  56. }
  57. }