Skip to content

Commit

Permalink
Build and bump
Browse files Browse the repository at this point in the history
  • Loading branch information
bumbu committed Mar 15, 2017
1 parent 1be71ca commit 94873df
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg-pan-zoom",
"version": "3.4.1",
"version": "3.5.0",
"homepage": "https://github.com/ariutta/svg-pan-zoom",
"authors": [
"Andrea Leofreddi <a.leofreddi@itcharm.com>",
Expand Down
2 changes: 1 addition & 1 deletion dist/svg-pan-zoom.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for svg-pan-zoom v3.4.1
// Type definitions for svg-pan-zoom v3.5.0
// Project: https://github.com/ariutta/svg-pan-zoom
// Definitions by: César Vidril <https://github.com/Yimiprod>
// Definitions: https://github.com/ariutta/svg-pan-zoom
Expand Down
34 changes: 26 additions & 8 deletions dist/svg-pan-zoom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// svg-pan-zoom v3.4.1
// svg-pan-zoom v3.5.0
// https://github.com/ariutta/svg-pan-zoom
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var svgPanZoom = require('./svg-pan-zoom.js');
Expand Down Expand Up @@ -371,6 +371,9 @@ ShadowViewport.prototype.setCTM = function(newCTM) {
if (this.options.beforeZoom(this.getRelativeZoom(), this.computeRelativeZoom(newCTM.a)) === false) {
newCTM.a = newCTM.d = this.activeState.zoom
willZoom = false
} else {
this.updateCache(newCTM);
this.options.onZoom(this.getRelativeZoom())
}
}

Expand Down Expand Up @@ -413,18 +416,15 @@ ShadowViewport.prototype.setCTM = function(newCTM) {
// Update willPan flag
if (preventPanX && preventPanY) {
willPan = false
} else {
this.updateCache(newCTM);
this.options.onPan(this.getPan());
}
}

// Check again if should zoom or pan
if (willZoom || willPan) {
this.updateCache(newCTM)

this.updateCTMOnNextFrame()

// After callbacks
if (willZoom) {this.options.onZoom(this.getRelativeZoom())}
if (willPan) {this.options.onPan(this.getPan())}
}
}
}
Expand Down Expand Up @@ -468,11 +468,18 @@ ShadowViewport.prototype.updateCTMOnNextFrame = function() {
* Update viewport CTM with cached CTM
*/
ShadowViewport.prototype.updateCTM = function() {
var ctm = this.getCTM()

// Updates SVG element
SvgUtils.setCTM(this.viewport, this.getCTM(), this.defs)
SvgUtils.setCTM(this.viewport, ctm, this.defs)

// Free the lock
this.pendingUpdate = false

// Notify about the update
if(this.options.onUpdatedCTM) {
this.options.onUpdatedCTM(ctm)
}
}

module.exports = function(viewport, options){
Expand Down Expand Up @@ -511,6 +518,7 @@ var optionsDefaults = {
, onPan: null
, customEventsHandler: null
, eventsListenerElement: null
, onUpdatedCTM: null
}

SvgPanZoom.prototype.init = function(svg, options) {
Expand Down Expand Up @@ -555,6 +563,9 @@ SvgPanZoom.prototype.init = function(svg, options) {
, onPan: function(point) {
if (that.viewport && that.options.onPan) {return that.options.onPan(point)}
}
, onUpdatedCTM: function(ctm) {
if (that.viewport && that.options.onUpdatedCTM) {return that.options.onUpdatedCTM(ctm)}
}
})

// Wrap callbacks into public API context
Expand All @@ -563,6 +574,7 @@ SvgPanZoom.prototype.init = function(svg, options) {
publicInstance.setOnZoom(this.options.onZoom)
publicInstance.setBeforePan(this.options.beforePan)
publicInstance.setOnPan(this.options.onPan)
publicInstance.setOnUpdatedCTM(this.options.onUpdatedCTM)

if (this.options.controlIconsEnabled) {
ControlIcons.enable(this)
Expand Down Expand Up @@ -1075,6 +1087,7 @@ SvgPanZoom.prototype.destroy = function() {
this.onZoom = null
this.beforePan = null
this.onPan = null
this.onUpdatedCTM = null

// Destroy custom event handlers
if (this.options.customEventsHandler != null) { // jshint ignore:line
Expand Down Expand Up @@ -1108,6 +1121,9 @@ SvgPanZoom.prototype.destroy = function() {
// Delete options and its contents
delete this.options

// Delete viewport to make public shadow viewport functions uncallable
delete this.viewport

// Destroy public instance and rewrite getPublicInstance
delete this.publicInstance
delete this.pi
Expand Down Expand Up @@ -1179,6 +1195,8 @@ SvgPanZoom.prototype.getPublicInstance = function() {
, zoomIn: function() {this.zoomBy(1 + that.options.zoomScaleSensitivity); return that.pi}
, zoomOut: function() {this.zoomBy(1 / (1 + that.options.zoomScaleSensitivity)); return that.pi}
, getZoom: function() {return that.getRelativeZoom()}
// CTM update
, setOnUpdatedCTM: function(fn) {that.options.onUpdatedCTM = fn === null ? null : Utils.proxy(fn, that.publicInstance); return that.pi}
// Reset
, resetZoom: function() {that.resetZoom(); return that.pi}
, resetPan: function() {that.resetPan(); return that.pi}
Expand Down
4 changes: 2 additions & 2 deletions dist/svg-pan-zoom.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg-pan-zoom",
"version": "3.4.1",
"version": "3.5.0",
"main": "dist/svg-pan-zoom.js",
"types": "dist/svg-pan-zoom.d.ts",
"browser": "src/browserify.js",
Expand Down

0 comments on commit 94873df

Please sign in to comment.