Enlarge Segment Geo Handles

Enlarges the geometry handles on segments so they are easier to find

  1. // ==UserScript==
  2. // @name Enlarge Segment Geo Handles
  3. // @namespace https://gf.qytechs.cn/users/30701-justins83-waze
  4. // @description Enlarges the geometry handles on segments so they are easier to find
  5. // @version 2023.03.21.01
  6. // @author JustinS83
  7. // @include https://www.waze.com/editor*
  8. // @include https://www.waze.com/*/editor*
  9. // @include https://beta.waze.com/editor*
  10. // @include https://beta.waze.com/*/editor*
  11. // @exclude https://www.waze.com/user/editor*
  12. // @grant none
  13. // @require https://gf.qytechs.cn/scripts/24851-wazewrap/code/WazeWrap.js
  14. // ==/UserScript==
  15.  
  16. /* global W */
  17. /* global WazeWrap */
  18. /* global $ */
  19.  
  20. (function() {
  21. 'use strict';
  22.  
  23. function bootstrap(tries = 1) {
  24. if (W &&
  25. W.map &&
  26. W.model &&
  27. W.loginManager.user &&
  28. $ &&
  29. WazeWrap.Ready)
  30. init();
  31. else if (tries < 1000)
  32. setTimeout(function () {bootstrap(++tries);}, 200);
  33. }
  34.  
  35. function init(){
  36. registerEvents(changeGeoHandleStyle);
  37. }
  38.  
  39. function changeGeoHandleStyle(){
  40. if(WazeWrap.hasSegmentSelected()){
  41. setTimeout(function(){
  42. let controls = W.map.controls.find((c) => c.dragControl != null); //W.map.controls.find((c) => c.displayClass === "WazeControlModifyFeatureSegment");
  43. let rules = controls.sketchLayer.styleMap.styles.default.rules;
  44. debugger;
  45. for(let i=0; i< rules.length; i++){
  46. if(rules[i].id === "OpenLayers_Rule_5"){ //2023-03-21 was Rule_30
  47. rules[i].symbolizer.pointRadius = 8;
  48. break;
  49. }
  50. }
  51. controls.resetVertices()
  52. unregisterEvents(changeGeoHandleStyle);
  53. },100);
  54. }
  55. }
  56.  
  57. function registerEvents(handler){
  58. WazeWrap.Events.register("selectionchanged", null, handler);
  59. WazeWrap.Events.register("afterundoaction",null, handler);
  60. WazeWrap.Events.register("afterclearactions",null, handler);
  61. WazeWrap.Events.register("afteraction",null, handler);
  62. }
  63.  
  64. function unregisterEvents(handler){
  65. WazeWrap.Events.unregister("selectionchanged", null, handler);
  66. WazeWrap.Events.unregister("afterundoaction",null, handler);
  67. WazeWrap.Events.unregister("afterclearactions",null, handler);
  68. WazeWrap.Events.unregister("afteraction",null, handler);
  69. }
  70.  
  71. bootstrap();
  72. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址