delahaye / dlh_googlemaps

Google Maps Extension für Contao
20 stars 26 forks source link

Swipe / Panning Ein- und Ausschalten #35

Closed zonky2 closed 10 years ago

zonky2 commented 10 years ago

Hallo Christian,

wie letzte Woche zur Konf. angesprochen hier nochmal der Hinweis im Ticketsystem zu https://community.contao.org/de/showthread.php?43953-Feature-weiterer-Zugriff-auf-Eigenschaften-der-Map&highlight=template

Gruss

delahaye commented 10 years ago

Pack ich mal auf die Wunschliste. Macht Sinn.

zonky2 commented 10 years ago

super! wenn Fragen sind oder ich was testen soll... call me :-)

delahaye commented 10 years ago

Das hab ich mir jetzt nochmal angesehen - kann man jetzt schon machen: Du brauchst, genau wie bei dynamischen Markierungen, Zoomänderungen eine passende Funktion:

Da kannst Du Deinen Teil (irgendeinen Clickevent drauflegen z.B.) ja ergänzen.

zonky2 commented 10 years ago

hmmm... wenn ich mir z.B. Deine Referenzinstallation ansehe http://dlhgm.delahaye.de/marker.html wird die ganze Map über die Funktion "gmap1_initialize()" gestartet - da die Funktion keine Rückgabewerte hat, kommt man "von Außen" nicht an die Eigenschaften der erstellen Maps ran, um z.B. so was zu machen: "map.setOptions({draggable: true});" http://stackoverflow.com/questions/13936853/how-do-i-change-the-google-maps-draggable-property-for-the-map-not-the-marker

delahaye commented 10 years ago

Darüber nicht, klar. Aber über die gmap1_dynmap() (siehe Anleitung dynamische Marker). Wenn das auch nicht geht, müsste ich doch die Map ganz anders einbinden, oder? Ggf. kannst Du auch eine dynamische Funktion in den erweiterten Parametern unterbringen? Da kann ich leider nicht viel zu sagen, mein Javascript hält sich in Grenzen.

zonky2 commented 10 years ago

ich habs... http://www.haus-zangerl.at/de/test.html

bei JS kann die Funktion auch wie eine "Klasse" angesprochen werden - man muss nur den Aufruf mit new machen und die public-Werte mit this anführen...

ist noch etwas dirty, da ich nur das Template geändert habe

zum Vergleich mein Template

<!-- indexer::stop -->
<section class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>

<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>

<div class="dlh_googlemap block" id="dlh_googlemap_<?php echo $this->map['id']; ?>" style="width:<?php echo $this->map['mapSize'][0].$this->map['mapSize'][2]; ?>;height:<?php echo $this->map['mapSize'][1].$this->map['mapSize'][2]; ?>;"><noscript><p><?php echo ($this->map['staticMapNoscript'] ? $this->map['staticMap'] : $this->labels['noscript']); ?></p></noscript></div>

<script>

function gmap<?php echo $this->map['id']; ?>_initialize() {
    var gmap<?php echo $this->map['id']; ?>_Options = {

        zoom: <?php echo $this->map['zoom']; ?>
        , center: new google.maps.LatLng(<?php echo $this->map['center']; ?>)
        , mapTypeId: google.maps.MapTypeId.<?php echo $this->map['mapTypeId']; ?>
        , draggable: <?php echo $this->map['draggable']; ?>
        , disableDoubleClickZoom: <?php echo $this->map['disableDoubleClickZoom']; ?>
        , scrollwheel: <?php echo $this->map['scrollwheel']; ?>

        <?php if ($this->map['useMapTypeControl']) : ?>
        , mapTypeControl: true
        , mapTypeControlOptions: {
            style: google.maps.MapTypeControlStyle.<?php echo $this->map['mapTypeControlStyle']; ?>
            , position: google.maps.ControlPosition.<?php echo $this->map['mapTypeControlPos']; ?>
            <?php if (is_array($this->map['mapTypesAvailable'])) : ?>
            , mapTypeIds: [
                <?php foreach($this->map['mapTypesAvailable'] as $k=>$v) : ?>
                    <?php if($k>0) echo ','; ?>google.maps.MapTypeId.<?php echo $v; ?>
                <?php endforeach; ?>
                ]
            <?php endif; ?>
        }
        <?php else : ?>
        , mapTypeControl: false
        <?php endif; ?>

        <?php if ($this->map['useOverviewMapControl']) : ?>
        , overviewMapControl: true
        , overviewMapControlOptions: {
            opened: <?php echo ($this->map['overviewMapControlOpened'] ? 'true':'false'); ?>
        }
        <?php else : ?>
        , overviewMapControl: false
        <?php endif; ?>

        <?php if ($this->map['useStreetViewControl']) : ?>
        , streetViewControl: true
        , streetViewControlOptions: {
            position: google.maps.ControlPosition.<?php echo $this->map['streetViewControlPos']; ?>
        }
        <?php else : ?>
        , streetViewControl: false
        <?php endif; ?>

        <?php if ($this->map['useRotateControl']) : ?>
        , rotateControl: true
        , rotateControlOptions: {
            position: google.maps.ControlPosition.<?php echo $this->map['rotateControlPos']; ?>
        }
        <?php else : ?>
        , rotateControl: false
        <?php endif; ?>

        <?php if ($this->map['usePanControl']) : ?>
        , panControl: true
        , panControlOptions: {
            position: google.maps.ControlPosition.<?php echo $this->map['panControlPos']; ?>
        }
        <?php else : ?>
        , panControl: false
        <?php endif; ?>

        <?php if ($this->map['useZoomControl']) : ?>
        , zoomControl: true
        , zoomControlOptions: {
            style: google.maps.ZoomControlStyle.<?php echo $this->map['zoomControlStyle']; ?>,
            position: google.maps.ControlPosition.<?php echo $this->map['zoomControlPos']; ?>
        }
        <?php else : ?>
        , zoomControl: false
        <?php endif; ?>

        <?php if ($this->map['useScaleControl']) : ?>
        , scaleControl: true
        , scaleControlOptions: {
            position: google.maps.ControlPosition.<?php echo $this->map['scaleControlPos']; ?>
        }
        <?php else : ?>
        , scaleControl: false
        <?php endif; ?>

        <?php if ($this->map['parameter']) : ?>
        , <?php echo $this->map['parameter']; ?>
        <?php endif; ?>

    };

    this.myGmap<?php echo $this->map['id']; ?> = new google.maps.Map(document.getElementById("dlh_googlemap_<?php echo $this->map['id']; ?>"), gmap<?php echo $this->map['id']; ?>_Options);

    var gmap<?php echo $this->map['id']; ?> = this.myGmap<?php echo $this->map['id']; ?>;

    <?php if ($this->map['moreParameter']) : echo $this->map['moreParameter']; endif; ?>

    <?php
    // Auto-generated map elements
    foreach($this->map['elements'] as $element) : echo $element['parsed']; endforeach; ?>

    if(window.gmap<?php echo $this->map['id']; ?>_dynmap){
        gmap<?php echo $this->map['id']; ?>_dynmap(gmap<?php echo $this->map['id']; ?>);
    }

    <?php 
    // tabcontrol
    echo $this->tabs ? $this->map['tabsCode'] : ''; ?>

}

if(window.addEvent) {
    window.addEvent('domready', function() {
        myMap<?php echo $this->map['id']; ?> = new gmap<?php echo $this->map['id']; ?>_initialize();
    });
} else if(typeof jQuery == "function") {
    jQuery(document).ready(function(){
        myMap<?php echo $this->map['id']; ?> = new gmap<?php echo $this->map['id']; ?>_initialize();
    });
} else {
    myMap<?php echo $this->map['id']; ?> = new gmap<?php echo $this->map['id']; ?>_initialize();
}

(function($) {
    jQuery(document).ready(function(){
        $('.draggable_on').click(function() {
            myMap<?php echo $this->map['id']; ?>.myGmap<?php echo $this->map['id']; ?>.draggable = true;
        });

        $('.draggable_off').click(function() {
            myMap<?php echo $this->map['id']; ?>.myGmap<?php echo $this->map['id']; ?>.draggable = false;
        });
    });
})(jQuery);

</script>

</section>
<!-- indexer::continue -->
zonky2 commented 10 years ago

... kannst Du was damit anfangen oder brauchst Du hier noch "Mit-Hilfe"?