diff --git a/src/SvgPanZoom.vue b/src/SvgPanZoom.vue
index 3176834..6cd9eb0 100644
--- a/src/SvgPanZoom.vue
+++ b/src/SvgPanZoom.vue
@@ -1,6 +1,9 @@
+
+
+
@@ -10,9 +13,14 @@ import svg_pan_zoom from 'svg-pan-zoom';
import props from './props';
+import thumbnailViewer from './thumbnailViewer';
+import SvgPanZoomThumbnail from './SvgPanZoomThumbnail.vue';
+
export default {
props,
+ components: { SvgPanZoomThumbnail },
computed: {
+ has_thumbnail: function() { return this.$slots.thumbnail },
options: function() {
let options = {};
@@ -26,7 +34,20 @@ export default {
}
},
mounted: function() {
- svg_pan_zoom( this.$slots.default[0].elm , this.options );
+ let options = {};
+
+ Object.keys(props).filter( k => this[k] !== undefined ).forEach( k => options[k] = this[k] );
+
+ if( this.has_thumbnail ) {
+ this.$slots.thumbnail[0].elm.id = 'thumbView';
+ thumbnailViewer({
+ mainViewId: this.$slots.default[0].elm.id,
+ thumbViewId: 'thumbView',
+ });
+ }
+ else {
+ svg_pan_zoom( this.$slots.default[0].elm , options );
+ }
},
};
diff --git a/src/SvgPanZoomThumbnail.vue b/src/SvgPanZoomThumbnail.vue
index 275d40a..f6d8379 100644
--- a/src/SvgPanZoomThumbnail.vue
+++ b/src/SvgPanZoomThumbnail.vue
@@ -7,7 +7,7 @@
-
+
diff --git a/src/index.js b/src/index.js
index e7ef74c..879c401 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,4 +1,5 @@
import SvgPanZoom from './SvgPanZoom.vue';
+import SvgPanZoomThumbnail from './SvgPanZoomThumbnail.vue';
export { SvgPanZoom };
export default SvgPanZoom;
diff --git a/src/stories.js b/src/stories.js
index f81dcb8..36f2407 100644
--- a/src/stories.js
+++ b/src/stories.js
@@ -14,5 +14,5 @@ const stories = storiesOf('SvgPanZoom', module)
() => SingleStory
)
.add( 'layers', () => LayerStory )
-.add( 'thumbnail', () => ThumbnailStory )
+.add( 'thumbnail -- needs to be first story loaded to work', () => ThumbnailStory )
;
diff --git a/src/thumbnail.stories.vue b/src/thumbnail.stories.vue
index e6db368..614f3af 100644
--- a/src/thumbnail.stories.vue
+++ b/src/thumbnail.stories.vue
@@ -1,9 +1,9 @@
-
@@ -12,7 +12,7 @@