Plugin Directory

Changeset 2380871


Ignore:
Timestamp:
09/14/2020 09:13:00 AM (6 years ago)
Author:
teplosup
Message:

Add version 1.3.7

Location:
shmapper-by-teplitsa
Files:
80 added
11 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • shmapper-by-teplitsa/trunk/assets/js/ShMapper.yandex.js

    r2380712 r2380871  
    330330                myPlacemark.events.add("dragend", evt =>
    331331                {
     332
     333                    var shmCoordinates = evt.get('target').geometry.getCoordinates();
     334                    $("[name='shm_default_latitude']").val(shmCoordinates[0]).trigger('change');
     335                    $("[name='shm_default_longitude']").val(shmCoordinates[1]).trigger('change');
     336
    332337                    var pos = evt.get("position");
    333338                    var globalPixelPoint = myMap.converter.pageToGlobal( [pos[0], pos[1]] );
     
    337342                    initAddress(new_mark_coords);
    338343                });
    339             }
     344
     345                // On change zoom.
     346                myMap.events.add('boundschange', function(e){
     347                    zoom = myMap.getZoom();
     348                    $('[name=shm_default_zoom]').val( zoom ).trigger('change');
     349                });
     350            }
     351
    340352            if( mData.isClausterer )
    341353            {
     
    358370    is_admin = function(myMap, mData)
    359371    {
     372
    360373        if(mData.isMap)
    361374        {
     375
    362376            myMap.events.add( 'boundschange', function(event)
    363377            {
  • shmapper-by-teplitsa/trunk/class/ShMapper.class.php

    r2380712 r2380871  
    412412        $longitude = 37.8;
    413413        $zoom      = 4;
    414         if ( static::$options['shm_default_zoom'] ) {
     414        if ( isset( static::$options['shm_default_zoom'] ) && static::$options['shm_default_zoom'] ) {
    415415            $zoom = static::$options['shm_default_zoom'];
    416416        }
    417         if ( static::$options['shm_default_latitude'] ) {
     417        if ( isset( static::$options['shm_default_latitude'] ) && static::$options['shm_default_latitude'] ) {
    418418            $latitude = static::$options['shm_default_latitude'];
    419419        }
    420         if ( static::$options['shm_default_longitude'] ) {
     420        if ( isset( static::$options['shm_default_longitude'] ) && static::$options['shm_default_longitude'] ) {
    421421            $longitude = static::$options['shm_default_longitude'];
    422422        }
     
    595595                            jQuery(document).ready( function($)
    596596                            {
    597                                 var points      = [];
    598                                 var mData = {
    599                                     mapType         : '$mapType',
    600                                     uniq            : 'map_default_coordinates',
    601                                     muniq           : 'map_default_coordinates',
    602                                     latitude        : '$latitude',
    603                                     longitude       : '$longitude',
    604                                     zoom            : '$zoom',
    605                                     map_id          : 'default_coordinates',
    606                                     isClausterer    : 0,
    607                                     isLayerSwitcher : 0,
    608                                     isFullscreen    : 1,
    609                                     isDesabled      : 0,
    610                                     isSearch        : 1,
    611                                     isZoomer        : 1,
    612                                     isAdmin         : 0,
    613                                     isMap           : true,
    614                                 };
    615                                
    616597                                if( map_type == 1 ) {
     598
     599                                    var points      = [],
     600                                    p = {};
     601                                    p.post_id   = '';
     602                                    p.post_title    = 'Черновик';
     603                                    p.post_content  = 'content';
     604                                    p.latitude      = '$latitude';
     605                                    p.longitude     = '$longitude';
     606                                    p.location      = '';
     607                                    p.draggable     = 1;
     608                                    p.type          = '-1';
     609                                    p.height        = '';
     610                                    p.width         = '';
     611                                    p.term_id       = '-1';
     612                                    p.icon          = '';
     613                                    p.color         = '';
     614
     615                                    points.push(p);
     616
     617                                    var mData = {
     618                                        mapType         : 'map',
     619                                        uniq            : 'map_default_coordinates',
     620                                        muniq           : 'map_default_coordinates',
     621                                        latitude        : p.latitude,
     622                                        longitude       : p.longitude,
     623                                        zoom            : '$zoom',
     624                                        map_id          : '',
     625                                        isClausterer    : 0,
     626                                        isLayerSwitcher : 0,
     627                                        isFullscreen    : 1,
     628                                        isDesabled      : 0,
     629                                        isSearch        : 1,
     630                                        isZoomer        : 1,
     631                                        isAdmin         : 1,
     632                                        isMap           : 0
     633                                    };
     634
    617635                                    ymaps.ready(() => init_map( mData, points ));
     636
    618637                                } else if (map_type == 2) {
     638
     639                                    var points = [];
     640
     641                                    var mData = {
     642                                        mapType         : '$mapType',
     643                                        uniq            : 'map_default_coordinates',
     644                                        muniq           : 'map_default_coordinates',
     645                                        latitude        : '$latitude',
     646                                        longitude       : '$longitude',
     647                                        zoom            : '$zoom',
     648                                        map_id          : 'default_coordinates',
     649                                        isClausterer    : 0,
     650                                        isLayerSwitcher : 0,
     651                                        isFullscreen    : 1,
     652                                        isDesabled      : 0,
     653                                        isSearch        : 1,
     654                                        isZoomer        : 1,
     655                                        isAdmin         : 1,
     656                                        isMap           : true,
     657                                    };
     658
    619659                                    init_map( mData, points );
    620                                
    621                                     // On zoom map.
    622                                     myMap.on('zoom', function(e) {
    623                                         $('[name=shm_default_zoom]').val( myMap.getZoom() ).trigger('change');
    624                                     });
    625 
    626                                     // On move map.
    627                                     myMap.on('move', function(e) {
    628                                         marker.setLatLng(myMap.getCenter());
    629                                     });
    630 
    631                                     // On moveend map.
    632                                     myMap.on('moveend', function(e) {
    633                                         var shmCenter = myMap.getCenter();
    634                                         var shmLat = shmCenter.lat;
    635                                         var shmLng = shmCenter.lng;
    636                                         $('[name=shm_default_latitude]').val( shmLat ).trigger('change');
    637                                         $('[name=shm_default_longitude]').val( shmLng ).trigger('change');
    638                                         console.log($('[name=shm_default_longitude]').val());
    639                                         console.log($('[name=shm_default_latitude]').val());
    640                                     });
    641660
    642661                                    // Add Center Marker.
     
    648667                                    )
    649668                                    .addTo(myMap);
     669
     670                                    // On zoom map.
     671                                    myMap.on('zoom', function(e) {
     672                                        $('[name=shm_default_zoom]').val( myMap.getZoom() ).trigger('change');
     673                                    });
     674
     675                                    marker.on('dragend', function (e) {
     676                                        $('[name=shm_default_latitude]').val(marker.getLatLng().lat).trigger('change');
     677                                        $('[name=shm_default_longitude]').val(marker.getLatLng().lng).trigger('change');
     678                                    });
    650679                                }
    651 
     680                               
    652681                            });
    653682                        </script>
     683
    654684
    655685                            <input class='sh-form' name='shm_default_latitude' value='" . esc_attr( $latitude ) . "' readonly disabled>
  • shmapper-by-teplitsa/trunk/class/ShMapper_ajax.class.php

    r2380712 r2380871  
    445445                    $action,
    446446                    array(
    447                         //"msg" => __( "New coordinates saved" , SHMAPPER ),
     447                        "msg" => __( "New coordinates saved" , SHMAPPER ),
    448448                    ),
    449449                );
Note: See TracChangeset for help on using the changeset viewer.