added zoom and zoomBy call forward to svg-pan-zoom api

zoom
Alessio Carrafa 2019-09-26 17:52:13 +02:00
parent aba8972657
commit 843bc5abcd
2 changed files with 51 additions and 32 deletions

View File

@ -23,9 +23,11 @@ import { EventBus } from './EventBus';
import SvgPanZoomThumbnail from './SvgPanZoomThumbnail.vue';
import { SvgPanZoomApi } from './SvgPanZoomApi';
export default {
props,
components: { SvgPanZoomThumbnail },
props,
computed: {
has_thumbnail: function() { return this.$slots.thumbnail },
options: function() {
@ -40,6 +42,10 @@ export default {
return options;
}
},
data: () => ({
spz: null,
bus: EventBus()
}),
mounted: function() {
let options = {};
@ -59,7 +65,14 @@ export default {
this.$emit( 'svgpanzoom', this.spz );
},
data: () => ({ spz: null, bus: EventBus() }),
methods: {
zoom: function( v ){
this.spz.zoom( v );
},
zoomBy: function( v ){
this.spz.zoomBy( v );
}
}
};
</script>

6
src/SvgPanZoomApi.js Normal file
View File

@ -0,0 +1,6 @@
export const SvgPanZoomApi = ( SvgPanZoomInstance ) => ({
zoom: function( v ){
SvgPanZoomInstance.zoom( v );
},
zoomBy: ( v ) => SvgPanZoomInstance.zoomBy( v )
});