Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Увеличить svg - объект, SVG и JavaScript, Zoom 
:(
    Опции темы
JavaBabe
Дата 8.7.2008, 22:36 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 6
Регистрация: 5.12.2007

Репутация: нет
Всего: нет



Помогите, пожалуйста, найти ошибку! 
ХТМЛ:
Код

<script type="text/ecmascript" src="Zoom.js">  </script>
     
<p>
         <iframe id="svgmap" src="out.svg" type="image/svg+xml" width="750" height="400" scrolling="no"> </iframe>             
</p> 
 <form action="button.htm">
                        <div>
                            <button name="ZoomIn" type="button" onclick="Zoom(1.5)">
                                <p>
                                    <img src="ZoomInButton.gif" width="20" height="20" alt="ZoomInButton"><br>
                                </p>
                            </button>
                         </div>
  </form>                


SVG:
Код

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="g" transform="scale(1)">
  <rect x="0" y="0" width="30" height="30" fill="green" />
</g>
</svg>



И моя JS-функция: 
Код

    var svgDoc = document.getElementById("svgmap").getSVGDocument()
                  
                  function Zoom(faktor){
                     var g = svgDoc.getElementById("g")
                     var currentScale
                     var newScale
                     currentScale = g.currentScale
                     newScale = currentScale * faktor
                     g.setAttribute("transform", "scale("+ newScale +")")
                   }
                  
                  function ZoomReset(){
                      var g = svgDoc.getElementById("g")
                      g.setAttribute("transform", "scale(1)")
                  }



PM MAIL   Вверх
feosr
Дата 9.7.2008, 10:19 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Бывалый
*


Профиль
Группа: Участник
Сообщений: 174
Регистрация: 20.1.2007
Где: Минск

Репутация: 1
Всего: 2



Цитата

JavaScript - file://localhost/C:/Documents%20and%20Settings/Fesor-sama/Рабочий%20стол/Untitled-2.html
Inline script thread
Error:
name: TypeError
message: Statement on line 2: Cannot convert undefined or null to Object
Backtrace:
  Line 2 of inline#1 script in file://localhost/C:/Documents%20and%20Settings/Fesor-sama/Рабочий%20стол/Untitled-2.html
        var svgDoc = document.getElementById("svgmap").getSVGDocument()
stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'


Обственно вот)

Еще одно можно добавить:

Цитата

setZoomRatio(zratio) sets the current map display zoom ratio. 

This function can be used to zoom in or zoom out in the SVG map. (It does not change the center point of the map.) The original map zoom ratio without any zooming is 1, and higher zoom ratio values show the SVG map zoomed in. The map zoom ratio should be set to those values that fit predefined zoom levels. For example, if the zoomlevels value is 4 and zoomfactor value is 2, map zoom ratios at zoom level 0, 1, 2, and 3 will be 1, 2, 4, and 8, respectively; thus, in this example the zratio parameter value should be 1, 2, 4, or 8. For more information about predefined zoom levels, see the descriptions of the zoomlevels, zoomfactor, and zoomratio attributes in Section 3.2.1.1.


Это сообщение отредактировал(а) feosr - 9.7.2008, 10:21
PM MAIL WWW ICQ   Вверх
JavaBabe
Дата 9.7.2008, 11:43 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 6
Регистрация: 5.12.2007

Репутация: нет
Всего: нет



Цитата

setZoomRatio(zratio) sets the current map display zoom ratio. 

This function can be used to zoom in or zoom out in the SVG map. (It does not change the center point of the map.) The original map zoom ratio without any zooming is 1, and higher zoom ratio values show the SVG map zoomed in. The map zoom ratio should be set to those values that fit predefined zoom levels. For example, if the zoomlevels value is 4 and zoomfactor value is 2, map zoom ratios at zoom level 0, 1, 2, and 3 will be 1, 2, 4, and 8, respectively; thus, in this example the zratio parameter value should be 1, 2, 4, or 8. For more information about predefined zoom levels, see the descriptions of the zoomlevels, zoomfactor, and zoomratio attributes in Section 3.2.1.1.


Это же функция от Oracle MapViewer AS! У меня задание реализовать самой эти функции.
Как можно исправить мой скрипт? 
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: для новичков | Следующая тема »


 




[ Время генерации скрипта: 0.0657 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.