Review UI for SVG Vector Graphics files
Review Request #11846 — Created Oct. 8, 2021 and updated
Currently ReviewBoard has a limited way of rendering SVG files and does
not allow for proper scaling and zooming. We are now attempting to utilize
SVG potential to full extent and allow users to inifinitely scale/zoom SVG images.The new solution utilizes
viewBox
attribute of SVGs and attempts to manipulate it
in order to create zoom-in ability and ability to span SVG. Moreover, the solution
also dynamically rescales and adjusts comment boxes based on theviewBox
.Currently, the new features only apply to a single image, i.e. no diffs view.
The diff view with SVGs will behave the same way as with the bitmap images.
However, there is no ability to zoom in/out or span the SVG.
The UI was tested using Google Chrome and Safari.
Unit tests were but no additional tests were added.
Summary | ID | Author |
---|---|---|
2570c36b4c1cd76fcefc9b869ac25065dfef62ba | aruslanov@fispan.com | |
48cb0d906cb2bec1390c1f6296c8bb161cfac556 | aruslanov@fispan.com | |
753647f2c2d2688b96cd18dd421d114e37b4238f | aruslanov@fispan.com | |
e75fb177bb8e7094fbbb4bae97c8731335799bd7 | aruslanov@fispan.com | |
1dfdaf59151afa2452efbd34176085d7082c408b | aruslanov@fispan.com | |
9be62ebc9f064d77463e3d958cdbb383dd5e32a3 | aruslanov@fispan.com | |
1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 | aruslanov@fispan.com | |
8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c | aruslanov@fispan.com | |
686ee924c529be45913ccd98be573922e2fea000 | aruslanov@fispan.com | |
b4d94dc327afb9e25218d290576546b8bc0014eb | aruslanov@fispan.com | |
8766e47c39664558f544aaf7bce3f6c9b1e5025e | aruslanov@fispan.com | |
8debba864495af432a5fcbe60790abb4ece4b277 | aruslanov@fispan.com | |
be17d29350ea52b0ebdd64b9d8b01379456c5ec3 | aruslanov@fispan.com | |
009fbd5cf143509802c7b134ebceec40af20c982 | aruslanov@fispan.com | |
80be40ed63dbe7eabf8ae06e853b374a27583d90 | aruslanov@fispan.com | |
befa38482a9ed08523e51f500dfffd1d73712644 | aruslanov@fispan.com | |
cbaea543b76976a7077252f4085eba1550c7949e | aruslanov@fispan.com | |
32439633178192f77065896b91aae703ece28e99 | aruslanov@fispan.com | |
36ebf8bb1450f9afb7b34ba7e4eba62d934f463a | aruslanov@fispan.com | |
695325381aae48ddf9dc8aa1ce7861c7a8333182 | aruslanov@fispan.com | |
a7bcd730e93043c7ce57d1a96ee746365eb05c60 | aruslanov@fispan.com | |
25b54945aa2ea411da42d7a84e48506aae248d5b | aruslanov@fispan.com | |
94ccf4b1ce3c255929f9a8f2c491a396a60c8243 | aruslanov@fispan.com |
Description | From | Last Updated |
---|---|---|
The new toolbar seems to be SVG-specific. It would be ideal if the ability to zoom, pan, etc. could be … |
chipx86 | |
Is this an expected behaviour, or should the comment also change its position based on the zoom in/out of SVG? |
akim.ruslanov | |
In UI, discoverability is important. A person should ideally be able to see what options are available before having to … |
chipx86 | |
Col: 44 Missing semicolon. |
reviewbot | |
Col: 30 Missing semicolon. |
reviewbot | |
Col: 44 ['width'] is better written in dot notation. |
reviewbot | |
Col: 44 ['height'] is better written in dot notation. |
reviewbot | |
Col: 43 ['width'] is better written in dot notation. |
reviewbot | |
Col: 44 ['height'] is better written in dot notation. |
reviewbot | |
Col: 15 '$image' is defined but never used. |
reviewbot | |
Col: 63 Expected '===' and instead saw '=='. |
reviewbot | |
This is listening for events on an element with the image-diff-attachment which is a child of the current view, but … |
david | |
This event is getting ignored completely and I am not super sure why. The only reasoning I could find was … |
akim.ruslanov | |
This event works. I have tried this because I wanted to see if mousewheel event works at all. So my … |
akim.ruslanov | |
Col: 57 Missing semicolon. |
reviewbot | |
Col: 13 'imageSrc' is defined but never used. |
reviewbot | |
Col: 39 Missing semicolon. |
reviewbot | |
Col: 43 Missing semicolon. |
reviewbot | |
Col: 23 Missing semicolon. |
reviewbot | |
Col: 14 Missing semicolon. |
reviewbot | |
Col: 11 Missing semicolon. |
reviewbot | |
This function's sole purpose is to change viewBox value for the SVG based on the values passed from the parent … |
akim.ruslanov | |
Col: 19 '$image' is defined but never used. |
reviewbot | |
Col: 14 Missing semicolon. |
reviewbot | |
Col: 23 '$image' is defined but never used. |
reviewbot | |
Col: 18 Missing semicolon. |
reviewbot | |
Col: 23 '$image' is defined but never used. |
reviewbot | |
Col: 18 Missing semicolon. |
reviewbot | |
Col: 38 Missing semicolon. |
reviewbot | |
Col: 19 '$image' is defined but never used. |
reviewbot | |
Col: 14 Missing semicolon. |
reviewbot | |
Col: 23 '$image' is defined but never used. |
reviewbot | |
Col: 18 Missing semicolon. |
reviewbot | |
Col: 23 '$image' is defined but never used. |
reviewbot | |
Col: 18 Missing semicolon. |
reviewbot | |
Col: 59 Missing semicolon. |
reviewbot | |
Col: 61 Missing semicolon. |
reviewbot | |
Col: 54 Missing semicolon. |
reviewbot | |
Col: 38 Missing semicolon. |
reviewbot | |
As far as I understand, the main purpose of loadImages and onImagesLoaded is to ensure data like initial-width and scaling … |
akim.ruslanov | |
In order to inline the SVG, I need to asynchronously fetch them and use the parser after. However, if I … |
akim.ruslanov | |
Col: 11 Missing semicolon. |
reviewbot | |
Col: 11 Missing semicolon. |
reviewbot | |
Col: 44 Missing semicolon. |
reviewbot | |
Col: 38 Missing semicolon. |
reviewbot | |
Col: 46 Missing semicolon. |
reviewbot | |
Col: 11 Missing semicolon. |
reviewbot | |
Col: 60 Missing semicolon. |
reviewbot | |
Col: 62 Missing semicolon. |
reviewbot | |
Col: 92 Missing semicolon. |
reviewbot | |
Col: 130 Missing semicolon. |
reviewbot | |
Col: 150 Missing semicolon. |
reviewbot | |
Col: 15 Missing semicolon. |
reviewbot | |
Col: 11 Missing semicolon. |
reviewbot | |
Col: 72 Missing semicolon. |
reviewbot | |
Col: 46 Missing semicolon. |
reviewbot | |
Col: 72 Missing semicolon. |
reviewbot | |
Col: 46 Missing semicolon. |
reviewbot | |
Col: 40 Missing semicolon. |
reviewbot | |
Col: 72 Missing semicolon. |
reviewbot | |
Col: 19 'offset' is defined but never used. |
reviewbot | |
Col: 7 'SvgAttachmentView' is defined but never used. |
reviewbot | |
Col: 46 Missing semicolon. |
reviewbot | |
Col: 5 Expected '}' to match '{' from line 275 and instead saw 'getSelectionRegion'. |
reviewbot | |
Col: 23 Unorthodox function invocation. |
reviewbot | |
Col: 26 Expected ')' and instead saw '{'. |
reviewbot | |
Col: 27 Missing semicolon. |
reviewbot | |
Col: 1 Unexpected '}'. |
reviewbot | |
Col: 1 Expected ')' to match '(' from line 1 and instead saw '}'. |
reviewbot | |
Col: 1 Expected an assignment or function call and instead saw an expression. |
reviewbot | |
Col: 2 Missing semicolon. |
reviewbot | |
Col: 2 Expected an identifier and instead saw ')'. |
reviewbot | |
Col: 2 Expected an assignment or function call and instead saw an expression. |
reviewbot | |
Col: 72 Missing semicolon. |
reviewbot | |
Please change #444 to #rb-ns-ui.colors[@grey-20] |
david | |
This should probably be set in initialize instead of here. |
david | |
Can we call this svgPromise, just so people definitely know that it's a promise and not data? |
david | |
This looks like it's not actually a jQuery object, so we shouldn't use the $ in the variable name. |
david | |
Let's split this up: this.svgSize = { width: this.viewBox.width, height: this.viewBox.height, }; |
david | |
fetch already is a promise, so this whole thing can just be: return fetch(this.model.get('imageURL')) .then(res => res.text()) .then(data => { … |
david | |
Col: 46 Missing semicolon. |
reviewbot | |
What's going on here? |
david | |
Add a blank line between these. |
david | |
Too much indentation in here. |
david | |
Add a blank line between these. |
david | |
Can you explain this? Is this a TODO or FIXME? (if so, please use that text so it's searchable). This … |
david | |
This needs some blank lines to make it less dense. Comments also need to start with capital letters and end … |
david | |
Indent as such: this.viewBox = { x: ..., y: ..., }; |
david | |
Add a trailing comma here. |
david | |
Add spaces around - operator. |
david | |
Line is too long. Please wrap to 80 columns throughout. |
david | |
svgFetched is already a promise, so we don't need to wrap with return new Promise(() => {}) |
david | |
Typo? |
david | |
This shouldn't need async |
david | |
Did you test this with normal image attachments? |
david | |
We can use this.model.get('filename').endsWith('.svg') |
david | |
This needs a trailing comma. |
david | |
Parens and {} aren't necessary in here. Can just be .then(res => this._adjustPos()) |
david | |
Col: 72 Missing semicolon. |
reviewbot | |
If you search the JS code for dedent you'll see a better way to write this literal. |
david | |
Add a blank line between these two. |
david | |
This can use addClass. Also, please use single quotes: this.$('#dragging-mode-icon').addClass('fa fa-arrows') |
david | |
Same here. |
david | |
Add a blank line between these two. |
david | |
And here. |
david | |
And here. |
david | |
There's an extra space character at the end of this line. |
david | |
This new blank line should be removed. |
david | |
This line is definitely too long. Please wrap to 80 columns throughout. |
david | |
This new blank line should be removed. |
david | |
This new blank line should be removed. |
david | |
Col: 66 Missing semicolon. |
reviewbot | |
Col: 32 Missing semicolon. |
reviewbot | |
Col: 19 'offset' is defined but never used. |
reviewbot | |
Col: 80 Missing semicolon. |
reviewbot | |
Col: 19 'offset' is defined but never used. |
reviewbot | |
Col: 19 'offset' is defined but never used. |
reviewbot | |
Col: 80 Missing semicolon. |
reviewbot | |
Col: 19 'offset' is defined but never used. |
reviewbot | |
Can you place this so that it's listed alphabetically with other classes? |
chipx86 | |
There's a blank line here that you can get rid of. |
chipx86 | |
Since we have svg as a local variable, use it here and everywhere else in this function instead of this.svg … |
chipx86 | |
Comments should always end in a period. |
chipx86 | |
When building an object, format it like: this.svgSize = { width: this.viewBox.width, height: this.viewBox.height, }; (Notice the trailing comma on … |
chipx86 | |
This appears common in both the if and the else conditions. You should be able to just do it once … |
chipx86 | |
Do we need the .filter if we're already looping and checking values? Might as well just loop once, right? |
chipx86 | |
These can be const. |
chipx86 | |
Every time there's a comment after a statement, separate them with a blank line. This applies to any other relevant … |
chipx86 | |
Multi-line comments must always be in the form of: /* * ... * ... */ Also, make sure all comments … |
chipx86 | |
These can be const. |
chipx86 | |
These can be const. |
chipx86 | |
There should be a space before/after operators. This applies to other lines below. |
chipx86 | |
These can be const. |
chipx86 | |
This will need to have a key/value pair per line, starting after the variable declaration, as demonstrated in a comment … |
chipx86 | |
We already pulled out this.viewBox.width and .height into w and h, so let's reuse those, save an attribute lookup. |
chipx86 | |
Can you separate the variable declarations from the modifications? Think of code like paragraphs in a book. What is each … |
chipx86 | |
Blank line between these. |
chipx86 | |
Whitespace on either side of operators. Check the rest of the change for whitespace around operators. |
chipx86 | |
We're calling this.svg.getScreenCTM().inverse() more than once. Let's pull that into a variable and reuse it. |
chipx86 | |
We're already fetching these above (though the height is using the wrong function!). Let's reuse what we've already fetched. |
chipx86 | |
"the" viewBox of "the" SVG. There are other comments that will also need to be updated. |
chipx86 | |
This isn't really describing what this is. A lot of your other functions are giving the reader enough information to … |
chipx86 | |
This is indented too far. |
chipx86 | |
This will need a trailing comma. |
chipx86 | |
Can you move these up by the other click events, in alphabetical order? |
chipx86 | |
This needs a trailing comma. |
chipx86 | |
The parameters are no longer aligned. |
chipx86 | |
Going back to paragraphs: We're adjusting positions once the SVG has loaded. We're setting state for the view. We're managing … |
chipx86 | |
This can use dedent (grep the codebase for usage.) |
chipx86 | |
The class names used in this block of HTML are very generic. Not your fault — that's pretty common in … |
chipx86 | |
Our UI for image review isn't very accessible-friendly (ignore for a moment that the concept of reviewing a visual medium … |
chipx86 | |
Paragraphs: We're notifying anyone interested that the viewbox has changed. We're updating comment blocks. I'm not sure that this code … |
chipx86 | |
"trigger a corresponding handler". |
chipx86 | |
Better to have conditionals prioritize the truthy value when there's an else involved. So instead: if (this.enableCommenting) { ... } … |
chipx86 | |
"trigger a corresponding handler" Same with some other comments below. |
chipx86 | |
Same note as above regarding the truthy conditionals first. Applies to others below. |
chipx86 | |
This is something I feel the SVG implementation should be thinking about. |
chipx86 | |
The chaining needs to be indented 4 spaces relative to this.$el. |
chipx86 | |
Let's avoid the repeated this.model and just pull it out into a local variable first. |
chipx86 |
- Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com
Checks run (2 succeeded)
- Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com
Checks run (2 succeeded)
-
-
This event is getting ignored completely and I am not super sure why. The only reasoning I could find was that the event does not get triggered if the views are nested.
-
This event works. I have tried this because I wanted to see if
mousewheel
event works at all. So my best guess (from another comment), is that events get cancelled out when views are rendered in nested approach.
- Change Summary:
-
Event handling for mousewheel is now handled in
parent view and then relayed to child view. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com
- Change Summary:
-
Fixed zooming in offset caused due to
selection area. Moved from listening to
the changes in viewBox, to directly trigerring
function in child view from parent view - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com
- Change Summary:
-
Fixed zooming in offset caused due to
selection area. Moved from listening to
the changes in viewBox, to directly trigerring
function in child view from parent view.
Also fixed jshint problems. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com
Checks run (2 succeeded)
-
-
This function's sole purpose is to change viewBox value for the SVG based on the values passed from the parent view. One thing I am struggling to understand is to how correctly change the
src
value of the image. The current implementation is based onloadImages
function. This works perfectly fine but I can't explain completely why.
The part I am most confused about is why does line 334 triggerimage.onload
.
- Change Summary:
-
Added a button to switch between spanning and commenting.
Added an ability to drag SVG using mouse - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com
Checks run (1 failed, 1 succeeded)
JSHint
- Change Summary:
-
Dragging after the SVG was zoomed in no
longer triggers the SVG to be in the
original position. Comments scale with SVG
but the problem of position when zooming in
still presists. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com
Checks run (1 failed, 1 succeeded)
JSHint
- Change Summary:
-
Fixed multiple JSHint issues
- Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com
Checks run (2 succeeded)
-
-
As far as I understand, the main purpose of
loadImages
andonImagesLoaded
is to ensure data likeinitial-width
and scaling is correct on render.What I am trying to do right now is to dynamically inline SVGs by fetching the data and parsing it using the
DOMParser
. This will allow me to useSVGElement
API that's somewhat necessary for correct scaling, dragging and zooming. Should I be dynamically inlining the SVGs in loadImages or should that be done before any rendering even begins?
- Change Summary:
-
Possibly need to inline SVG to use
theSVGElement
API. Trying to figure
out if this is possible - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com
-
-
In order to inline the SVG, I need to asynchronously fetch them and use the parser after. However, if I do it like this, then the renderring of the image happens couple of seconds after the rest of the page got rendered. In addition, since we run some methods on the element, they fail since it didn't finish rendering. Any thoughts on how to combat that? I was thinking of maybe fetching the data in backend, or perhaps there is a way to fetch it in the model?
- Change Summary:
-
Finished migrating to SVGElements API.
Now any scaling, zooming or dragging happen
by changing the viewBox value directly.
The buttons are more flushed out. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com
Checks run (1 failed, 1 succeeded)
JSHint
- Change Summary:
-
Finished migrating to SVGElements API.
Now any scaling, zooming or dragging happen
by changing the viewBox value directly.
The buttons are more flushed out.
Fixed JSHint issues - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com
- Change Summary:
-
Added documentation to all new methods and
views. Code is cleaned up according to the
previous patterns - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com
- Change Summary:
-
Fixed whitespaces. Added a new method to
stringify viewBox so code wraps nicely in
review. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com
Checks run (1 failed, 1 succeeded)
JSHint
- Change Summary:
-
Fixed bug with
stringifyViewBox
where
it failed in the cases of cached viewBox - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com - Diff:
-
Revision 15 (+1747 -637)
- Added Files:
- Description:
-
Currently ReviewBoard has a limited way of rendering SVG files and does
not allow for proper scaling and zooming. We are now attempting to utilize SVG potential to full extent and allow users to inifinitely scale/zoom SVG images. The new solution utilizes
viewBox
attribute of SVGs and attempts to manipulate it~ in order to create zoom-in ability. ~ in order to create zoom-in ability and ability to span SVG.
-
-
-
-
-
-
-
fetch
already is a promise, so this whole thing can just be:return fetch(this.model.get('imageURL')) .then(res => res.text()) .then(data => { const parser = new DOMParser(); return parser.parseFromString(data, 'image/svg+xml') .querySelector('svg'); });
-
-
-
-
-
Can you explain this? Is this a TODO or FIXME? (if so, please use that text so it's searchable). This comment should also probably go inside the body of the function instead of above it.
-
This needs some blank lines to make it less dense. Comments also need to start with capital letters and end with periods.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
This can use
addClass
. Also, please use single quotes:this.$('#dragging-mode-icon').addClass('fa fa-arrows')
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Made changes according to David's comments.
Also wrapped other documentation in a better
way. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com
- Change Summary:
-
Made changes according to David's comments.
Also wrapped other documentation in a better
way. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com
Checks run (2 succeeded)
- Change Summary:
-
Comment boxes are scaled dynamically with
SVGs. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com
- Change Summary:
-
Comment boxes are dynamically scaled
and moved based on the viewBox. Whitespaces
and indentation fixed. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com a7bcd730e93043c7ce57d1a96ee746365eb05c60 aruslanov@fispan.com
- Change Summary:
-
Comment boxes are dynamically scaled
and moved based on the viewBox. Whitespaces
and indentation fixed. - Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com a7bcd730e93043c7ce57d1a96ee746365eb05c60 aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com a7bcd730e93043c7ce57d1a96ee746365eb05c60 aruslanov@fispan.com 25b54945aa2ea411da42d7a84e48506aae248d5b aruslanov@fispan.com
Checks run (2 succeeded)
- Change Summary:
-
Updated description and testing.
- Description:
-
Currently ReviewBoard has a limited way of rendering SVG files and does
not allow for proper scaling and zooming. We are now attempting to utilize SVG potential to full extent and allow users to inifinitely scale/zoom SVG images. The new solution utilizes
viewBox
attribute of SVGs and attempts to manipulate it~ in order to create zoom-in ability and ability to span SVG. ~ in order to create zoom-in ability and ability to span SVG. Moreover, the solution + also dynamically rescales and adjusts comment boxes based on the viewBox
.+ + Currently, the new features only apply to a single image, i.e. no diffs view.
+ The diff view with SVGs will behave the same way as with the bitmap images. + However, there is no ability to zoom in/out or span the SVG. - Testing Done:
-
The UI was tested using Google Chrome and Safari.
~ No unit tests were run yet and no additional tests added.
~ Unit tests were but no additional tests were added.
- Change Summary:
-
Fixing whitespaces.
- Commits:
-
Summary ID Author 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com a7bcd730e93043c7ce57d1a96ee746365eb05c60 aruslanov@fispan.com 25b54945aa2ea411da42d7a84e48506aae248d5b aruslanov@fispan.com 2570c36b4c1cd76fcefc9b869ac25065dfef62ba aruslanov@fispan.com 48cb0d906cb2bec1390c1f6296c8bb161cfac556 aruslanov@fispan.com 753647f2c2d2688b96cd18dd421d114e37b4238f aruslanov@fispan.com e75fb177bb8e7094fbbb4bae97c8731335799bd7 aruslanov@fispan.com 1dfdaf59151afa2452efbd34176085d7082c408b aruslanov@fispan.com 9be62ebc9f064d77463e3d958cdbb383dd5e32a3 aruslanov@fispan.com 1ca946ca853b4c18f6be2032dcc607a1ee6a71c9 aruslanov@fispan.com 8d0966d5ca11e4b18e6306fe7c0a1b1ed569681c aruslanov@fispan.com 686ee924c529be45913ccd98be573922e2fea000 aruslanov@fispan.com b4d94dc327afb9e25218d290576546b8bc0014eb aruslanov@fispan.com 8766e47c39664558f544aaf7bce3f6c9b1e5025e aruslanov@fispan.com 8debba864495af432a5fcbe60790abb4ece4b277 aruslanov@fispan.com be17d29350ea52b0ebdd64b9d8b01379456c5ec3 aruslanov@fispan.com 009fbd5cf143509802c7b134ebceec40af20c982 aruslanov@fispan.com 80be40ed63dbe7eabf8ae06e853b374a27583d90 aruslanov@fispan.com befa38482a9ed08523e51f500dfffd1d73712644 aruslanov@fispan.com cbaea543b76976a7077252f4085eba1550c7949e aruslanov@fispan.com 32439633178192f77065896b91aae703ece28e99 aruslanov@fispan.com 36ebf8bb1450f9afb7b34ba7e4eba62d934f463a aruslanov@fispan.com 695325381aae48ddf9dc8aa1ce7861c7a8333182 aruslanov@fispan.com a7bcd730e93043c7ce57d1a96ee746365eb05c60 aruslanov@fispan.com 25b54945aa2ea411da42d7a84e48506aae248d5b aruslanov@fispan.com 94ccf4b1ce3c255929f9a8f2c491a396a60c8243 aruslanov@fispan.com
Checks run (2 succeeded)
-
This feature is great! Now, I have a lot of comments here. Most of them have to do with coding style standards (trailing commas, blank lines, indentation, ordering, etc.). The kind of things that make a review large, but will help the code really fit and stay maintainable once complete.
There is a bigger note in here, and I'd take it on after the stylistic stuff so that those bits are less distracting. That note has to do with the UI. I think what you had was great for development, but buttons that toggle their behavior when clicked is problematic, for reasons I'll outline below.
-
The new toolbar seems to be SVG-specific. It would be ideal if the ability to zoom, pan, etc. could be done on bitmap as well. Is that possible? If not, what would be required to make that happen (as work for after this goes in)?
Ideally, we'd end up with one unifying interface that was common regardless of image type.
-
In UI, discoverability is important. A person should ideally be able to see what options are available before having to interact. In this case, we have two icons that each conceal an alternate state, with no way (aside from trial-and-error or reading documentation) to know about that state.
I'd suggest splitting each of these into two buttons (with some separation between them to help show the grouping), and use a visual indicator to show which is selected (such as a background color that makes it clear which is active).
That way, a person will see their options up-front, and can choose them without having to remember what happens when they click each thing.
This is also really important for accessibility. If a person is using a screen reader, they'll have an even more difficult time selecting the desired action.
-
-
-
Since we have
svg
as a local variable, use it here and everywhere else in this function instead ofthis.svg
(which requires an attribute lookup). -
-
When building an object, format it like:
this.svgSize = { width: this.viewBox.width, height: this.viewBox.height, };
(Notice the trailing comma on the last line as well. This avoids needing to change that line if ever adding more entries for any reason.)
-
This appears common in both the
if
and theelse
conditions. You should be able to just do it once after the conditionals end. -
Do we need the
.filter
if we're already looping and checking values? Might as well just loop once, right? -
-
Every time there's a comment after a statement, separate them with a blank line.
This applies to any other relevant comments in the change.
-
Multi-line comments must always be in the form of:
/* * ... * ... */
Also, make sure all comments are in sentence casing with trailing periods.
This applies to any other relevant comments in the change.
-
-
-
-
-
This will need to have a key/value pair per line, starting after the variable declaration, as demonstrated in a comment above.
This applies to other such objects below.
-
We already pulled out
this.viewBox.width
and.height
intow
andh
, so let's reuse those, save an attribute lookup. -
Can you separate the variable declarations from the modifications?
Think of code like paragraphs in a book. What is each paragraph trying to communicate? Is it a big dense paragraph that's trying to say many things, or does each have purpose?
I see the following paragraphs in this function:
- We're determining the scaling based on stored state.
- We're telling the element what its size should be.
- We're telling the SVG what its new size and viewBox should be.
- We're setting new state on the iew.
-
-
Whitespace on either side of operators.
Check the rest of the change for whitespace around operators.
-
We're calling
this.svg.getScreenCTM().inverse()
more than once. Let's pull that into a variable and reuse it. -
We're already fetching these above (though the height is using the wrong function!).
Let's reuse what we've already fetched.
-
-
This isn't really describing what this is. A lot of your other functions are giving the reader enough information to know what to expect, and this should follow that pattern.
Also, make sure you aren't leaving off periods at the end of sentences.
-
-
-
-
-
-
Going back to paragraphs:
- We're adjusting positions once the SVG has loaded.
- We're setting state for the view.
- We're managing the DOM to display the view.
-
-
The class names used in this block of HTML are very generic. Not your fault — that's pretty common in a lot of our legacy code. We're trying to fix this with our CSS Component style: https://reviewboard.notion.site/CSS-LessCSS-Component-Style-Guide-ceb55ed87d954101a074f6601fc5deb2
You're not going to be able to retrofit all this onto that. No problem. Let's namespace these classes, though, and call them:
rb-c-image-review-svg-toolbar
rb-c-image-review-svg-toolbar__pan
rb-c-image-review-svg-toolbar__zoom
rb-c-image-review-svg-toolbar__drag
rb-c-image-review-svg-toolbar__comment
(This is based on prior suggestions on separating these.)
-
Our UI for image review isn't very accessible-friendly (ignore for a moment that the concept of reviewing a visual medium sort of isn't either).
Still, we want to make forward progress on any new UI. These actions need to be presentable to screen readers or any other accessibility tools. We can do that by:
- Telling the screen reader these are effectively buttons (
role="button"
) - Giving them a title/tooltip (
title="..."
) — basically what you'd want to see as alternative text for the icon, if the icon could not be shown. - Turn off reading of the icon (
aria-hidden="true"
)
- Telling the screen reader these are effectively buttons (
-
Paragraphs:
- We're notifying anyone interested that the viewbox has changed.
- We're updating comment blocks.
I'm not sure that this code should be assuming SVGs or viewboxes, though. I think it should be thinking in terms of zooming. Let the specific implementation know what that means.
-
-
Better to have conditionals prioritize the truthy value when there's an
else
involved. So instead:if (this.enableCommenting) { ... } else { ... }
-
-
-
-
-