From 24fd78d9a336bdabaddd89e39c1689f7e3e0c83f Mon Sep 17 00:00:00 2001 From: Jared Stoffan Date: Mon, 5 Oct 2020 16:08:18 -0700 Subject: [PATCH] fix(image): Remove unsupported svs file extension from image loaders (#1269) --- src/lib/icons/icons.js | 1 - .../viewers/box3d/image360/Image360Loader.js | 19 +-- src/lib/viewers/image/ImageLoader.js | 2 +- src/lib/viewers/image/README.md | 117 ++++++++++-------- 4 files changed, 64 insertions(+), 75 deletions(-) diff --git a/src/lib/icons/icons.js b/src/lib/icons/icons.js index 14e6273c5..a2d731b30 100644 --- a/src/lib/icons/icons.js +++ b/src/lib/icons/icons.js @@ -214,7 +214,6 @@ export const ICON_FILE_MAP = {}; 'raf', 'raw', 'svg', - 'svs', 'swf', 'tga', 'tif', diff --git a/src/lib/viewers/box3d/image360/Image360Loader.js b/src/lib/viewers/box3d/image360/Image360Loader.js index 1adc455a6..eb9bc3795 100644 --- a/src/lib/viewers/box3d/image360/Image360Loader.js +++ b/src/lib/viewers/box3d/image360/Image360Loader.js @@ -10,24 +10,7 @@ const VIEWERS = [ NAME: 'Image360', CONSTRUCTOR: Image360Viewer, REP: '3d', - EXT: [ - 'jpg', - 'jpeg', - 'png', - 'ai', - 'bmp', - 'dcm', - 'eps', - 'gif', - 'heic', - 'ps', - 'psd', - 'svg', - 'svs', - 'tga', - 'tif', - 'tiff', - ], + EXT: ['jpg', 'jpeg', 'png', 'ai', 'bmp', 'dcm', 'eps', 'gif', 'heic', 'ps', 'psd', 'svg', 'tga', 'tif', 'tiff'], }, ]; diff --git a/src/lib/viewers/image/ImageLoader.js b/src/lib/viewers/image/ImageLoader.js index dfc88097c..1470ab6a8 100644 --- a/src/lib/viewers/image/ImageLoader.js +++ b/src/lib/viewers/image/ImageLoader.js @@ -38,7 +38,7 @@ const VIEWERS = [ NAME: 'Image', CONSTRUCTOR: ImageViewer, REP: 'png', - EXT: ['ai', 'bmp', 'dcm', 'eps', 'gif', 'heic', 'png', 'ps', 'psd', 'svs', 'tga', 'tif', 'tiff'], + EXT: ['ai', 'bmp', 'dcm', 'eps', 'gif', 'heic', 'png', 'ps', 'psd', 'tga', 'tif', 'tiff'], ASSET: '1.png', }, ]; diff --git a/src/lib/viewers/image/README.md b/src/lib/viewers/image/README.md index 547f28acf..48b0629f2 100755 --- a/src/lib/viewers/image/README.md +++ b/src/lib/viewers/image/README.md @@ -3,73 +3,79 @@ The image viewer renders previews of image files. ## Screenshot + ![Screenshot of image viewer](../../../../images/image.png) ## Behavior + Rotating the viewer will rotate the image 90 degrees clockwise. At the default zoom level, clicking on the image will zoom in once. When zoomed in, clicking on the document will return to the default zoom level. When zoomed out, clicking on the document will zoom in until the original zoom level is reached. ### Controls: -* Zoom In -* Zoom Out -* Rotate -* Fullscreen: can be exited with the escape key + +- Zoom In +- Zoom Out +- Rotate +- Fullscreen: can be exited with the escape key ## Supported File Extensions -`ai, bmp, dcm, eps, gif, heic, png, ps, psd, svs, tga, tif, tiff` +`ai, bmp, dcm, eps, gif, heic, png, ps, psd, tga, tif, tiff` ## Options -| Option | Type | Description | -| --- | --- | --- | +| Option | Type | Description | +| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | annotations | boolean | Optional. Whether annotations on content are shown. Defaults to false. See [Box Annotations](https://github.com/box/box-annotations) for more details. | ## Events -The image viewer fires the following events -| Event Name | Explanation | Event Data | -| --- | --- | --- | -| destroy | The preview is intentionally destroyed || -| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | -| notification | A notification is displayed || -| navigate | The preview is shown for a given index | {object} file | -| reload | The preview reloads || -| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | -| zoom | The preview zooms in or out | 1. {number} **zoom**: new zoom value 2. {boolean} **canZoomIn**: true if the viewer can zoom in more 3. {boolean} **canZoomOut**: true if the viewer can zoom out more | -| pan | The preview is panning || -| panstart | Panning starts || -| panend | Panning ends || -| rotate | The image rotates || -| printsuccess | An attempt to print triggered successfully || +The image viewer fires the following events +| Event Name | Explanation | Event Data | +| ------------ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| destroy | The preview is intentionally destroyed | | +| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | +| notification | A notification is displayed | | +| navigate | The preview is shown for a given index | {object} file | +| reload | The preview reloads | | +| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | +| zoom | The preview zooms in or out | 1. {number} **zoom**: new zoom value 2. {boolean} **canZoomIn**: true if the viewer can zoom in more 3. {boolean} **canZoomOut**: true if the viewer can zoom out more | +| pan | The preview is panning | | +| panstart | Panning starts | | +| panend | Panning ends | | +| rotate | The image rotates | | +| printsuccess | An attempt to print triggered successfully | | ## Methods The following methods are available for the image viewer. -| Method Name | Explanation | Method Parameters | -| --- | --- | --- | -| zoom | Zooms the image | {string} 'in', 'out', or 'reset' | -| print | Prints the image || -| rotateLeft | Rotates the image counter-clockwise by 90 degrees || -| isRotated | Determines if the image has been rotated 90 or 270 degrees || -| toggleFullscreen | Toggles fullscreen mode || +| Method Name | Explanation | Method Parameters | +| ---------------- | ---------------------------------------------------------- | -------------------------------- | +| zoom | Zooms the image | {string} 'in', 'out', or 'reset' | +| print | Prints the image | | +| rotateLeft | Rotates the image counter-clockwise by 90 degrees | | +| isRotated | Determines if the image has been rotated 90 or 270 degrees | | +| toggleFullscreen | Toggles fullscreen mode | | # Multi-Page Image Viewer The multi-page image viewer renders previews of multi page image files. ## Screenshot + ![Screenshot of multi-page image viewer](../../../../images/multi-page.png) ## Behavior + At the default zoom level, clicking on the image will zoom in once. When zoomed in, clicking on the document will return to the default zoom level. When zoomed out, clicking on the document will zoom in until the original zoom level is reached. ### Controls: -* Zoom In -* Zoom Out -* Set Page: either with the up and down arrows, or by clicking the page number and entering text -* Fullscreen: can be exited with the escape key + +- Zoom In +- Zoom Out +- Set Page: either with the up and down arrows, or by clicking the page number and entering text +- Fullscreen: can be exited with the escape key ## Supported File Extensions @@ -77,35 +83,36 @@ At the default zoom level, clicking on the image will zoom in once. When zoomed ## Options -| Option | Type | Description | -| --- | --- | --- | +| Option | Type | Description | +| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | annotations | boolean | Optional. Whether annotations on content are shown. Defaults to false. See [Box Annotations](https://github.com/box/box-annotations) for more details. | ## Events + The image viewer fires the following events -| Event Name | Explanation | Event Data | -| --- | --- | --- | -| destroy | The preview is intentionally destroyed || -| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | -| notification | A notification is displayed || -| navigate | The preview is shown for a given index | {object} file | -| reload | The preview reloads || -| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | -| zoom | The preview zooms in or out | 1. {number} **zoom**: new zoom value 2. {boolean} **canZoomIn**: true if the viewer can zoom in more 3. {boolean} **canZoomOut**: true if the viewer can zoom out more | -| pagefocus | A page is visible | {number} page number of focused page | -| pan | The preview is panning || -| panstart | Panning starts || -| panend | Panning ends || +| Event Name | Explanation | Event Data | +| ------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| destroy | The preview is intentionally destroyed | | +| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | +| notification | A notification is displayed | | +| navigate | The preview is shown for a given index | {object} file | +| reload | The preview reloads | | +| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | +| zoom | The preview zooms in or out | 1. {number} **zoom**: new zoom value 2. {boolean} **canZoomIn**: true if the viewer can zoom in more 3. {boolean} **canZoomOut**: true if the viewer can zoom out more | +| pagefocus | A page is visible | {number} page number of focused page | +| pan | The preview is panning | | +| panstart | Panning starts | | +| panend | Panning ends | | ## Methods The following methods are available for the multi-page image viewer. -| Method Name | Explanation | Method Parameters | -| --- | --- | --- | -| zoom | Zooms the image | {string} 'in', 'out', or 'reset' | -| previousPage | Navigates to the previous page || -| nextPage | Navigates to the next page || -| setPage | Navigates to a given page | {number} page number | -| toggleFullscreen | Toggles fullscreen mode || +| Method Name | Explanation | Method Parameters | +| ---------------- | ------------------------------ | -------------------------------- | +| zoom | Zooms the image | {string} 'in', 'out', or 'reset' | +| previousPage | Navigates to the previous page | | +| nextPage | Navigates to the next page | | +| setPage | Navigates to a given page | {number} page number | +| toggleFullscreen | Toggles fullscreen mode | |