1/** 2 * @namespace WPGMZA 3 * @module OLModernStoreLocatorCircle 4 * @requires WPGMZA.ModernStoreLocatorCircle 5 */ 6jQuery(function($) { 7 8 WPGMZA.OLModernStoreLocatorCircle = function(map, settings) 9 { 10 WPGMZA.ModernStoreLocatorCircle.call(this, map, settings); 11 } 12 13 WPGMZA.OLModernStoreLocatorCircle.prototype = Object.create(WPGMZA.ModernStoreLocatorCircle.prototype); 14 WPGMZA.OLModernStoreLocatorCircle.prototype.constructor = WPGMZA.OLModernStoreLocatorCircle; 15 16 WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer = function() 17 { 18 var self = this; 19 var mapElement = $(this.map.element); 20 var olViewportElement = mapElement.children(".ol-viewport"); 21 22 this.canvas = document.createElement("canvas"); 23 this.canvas.className = "wpgmza-ol-canvas-overlay"; 24 olViewportElement.find('.ol-layers .ol-layer:first-child').prepend(this.canvas); 25 26 this.renderFunction = function(event) { 27 28 if(self.canvas.width != olViewportElement.width() || self.canvas.height != olViewportElement.height()) 29 { 30 self.canvas.width = olViewportElement.width(); 31 self.canvas.height = olViewportElement.height(); 32 33 $(this.canvas).css({ 34 width: olViewportElement.width() + "px", 35 height: olViewportElement.height() + "px" 36 }); 37 } 38 39 self.draw(); 40 }; 41 42 this.map.olMap.on("postrender", this.renderFunction); 43 } 44 45 WPGMZA.OLModernStoreLocatorCircle.prototype.getContext = function(type) 46 { 47 return this.canvas.getContext(type); 48 } 49 50 WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions = function() 51 { 52 return { 53 width: this.canvas.width, 54 height: this.canvas.height 55 }; 56 } 57 58 WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels = function() 59 { 60 var center = this.map.latLngToPixels(this.settings.center); 61 62 return center; 63 } 64 65 WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset = function() 66 { 67 return { 68 x: 0, 69 y: 0 70 }; 71 } 72 73 WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius = function(km) 74 { 75 var center = new WPGMZA.LatLng(this.settings.center); 76 var outer = new WPGMZA.LatLng(center); 77 78 outer.moveByDistance(km, 90); 79 80 var centerPixels = this.map.latLngToPixels(center); 81 var outerPixels = this.map.latLngToPixels(outer); 82 83 return Math.abs(outerPixels.x - centerPixels.x); 84 85 /*if(!window.testMarker){ 86 window.testMarker = WPGMZA.Marker.createInstance({ 87 position: outer 88 }); 89 WPGMZA.maps[0].addMarker(window.testMarker); 90 } 91 92 return 100;*/ 93 } 94 95 WPGMZA.OLModernStoreLocatorCircle.prototype.getScale = function() 96 { 97 return 1; 98 } 99 100 WPGMZA.OLModernStoreLocatorCircle.prototype.destroy = function() 101 { 102 $(this.canvas).remove(); 103 104 this.map.olMap.un("postrender", this.renderFunction); 105 this.map = null; 106 this.canvas = null; 107 } 108 109});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.