Canvas For Rendering UX
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 287 | |
Author | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/56871 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
00:00
DiagramEngineering drawing
00:36
Presentation of a groupArtistic renderingComputer animation
00:44
Artistic renderingComputer-generated imageryCore dumpImplementationImage resolutionPixelElement (mathematics)Sheaf (mathematics)Object (grammar)Event horizonWeb browserCross-site scriptingData managementCursor (computers)Software testingMereologyEmailIdeal (ethics)TouchscreenSocial classData structureTerm (mathematics)Cellular automatonType theoryKeyboard shortcutTable (information)Graphics tabletLibrary (computing)Hausdorff dimensionWindowImage resolutionCausalityMultiplication signSoftwareSoftware testingPixelPosition operatorLibrary (computing)ImplementationMereologyEvent horizonWeb browserMedical imagingFood energyPresentation of a groupAxiom of choicePropagatorSocial classWindowElement (mathematics)ResultantSheaf (mathematics)Physical lawObject (grammar)Data structureEmailTesselationTable (information)Slide ruleClient (computing)Graph coloringGroup actionMassUnit testingTouch typingDisk read-and-write headCASE <Informatik>Boss CorporationNumberProduct (business)Point (geometry)Shape (magazine)Cursor (computers)WeightVotingBitCategory of beingRow (database)CalculusClique-widthDimensional analysisPointer (computer programming)State of matterExecution unitConsistencyGame controllerWebsiteFloating pointCore dumpArtistic renderingCodeComputer animation
09:41
Computer animation
Transcript: English(auto-generated)
00:39
Hello, and welcome to our presentation about canvas rendering. I'm Gokashe Chatur. I will be presenting you
00:48
why we are using a canvas object and how we are using it and what the results we get at the end. Kolobor online as you know uses images sent from the core site for rendering the documents.
01:02
Users need to be able to view documents comfortably but the technology is rapidly improving and it's created high-resolution devices with tiny pixels as we aim to have consistent look across as many devices as we can. We need to have a new solution for having crisp images in all targeted
01:21
devices we choose to use a canvas object. One of the problems we saw was blurry images. Another one was gaps between tiles. HTML canvas object helped us overcome these issues in a proper and maintainable way. We will first talk about how we render the tiles and UI. Then we are going to have a look at our implementation. As last step of our presentation,
01:43
we will have a look at the great results we have. And let's move to the second slide and we will have a look at benefits in detail. Kolobor online is now using an HTML canvas element for rendering the tiles along with consistent look.
02:03
There are other benefits that we have with this choice. Let me talk about these items. It is easier to maintain and improve. We now have our own class canvas section container. Thanks to this new structure, we have control over events and UI. It's designed to work isolated and flexible enough to be improved.
02:25
At the end, we reduced the need for the third-party libraries that we were using for event handling and UI. One of the challenges of using a canvas for UI and event handling was with testing. We are using Cypress test library for testing the behavior of our library.
02:43
Unlike unit testing, Cypress library works like a real user and it checks the HTML elements states to see if the software is working or not. Since our canvas drawings are inside canvas and thus not HTML elements, it was a challenge to test the behavior of our drawings. We solved this issue by creating cross-pending
03:05
HTML elements for our drawings. These HTML elements are created only while testing. Now we have testable and ready-to-use canvas library. Our main target was rendering the tiles onto a canvas object.
03:24
This is done by using more tiles for devices with tiny pixels so users can benefit from the high resolution of their devices. And rendering the UI. After having a class for canvas rendering, we could easily use this class for also some parts of our UI.
03:42
Our gain is fast reaction time and implementation. So having some things drawn on a canvas element doesn't make those work for the user. We needed event handling.
04:01
Certainly, we needed to know about where the mouse pointer is, is user holding a button and the like. For solving this issue, we added event handling capabilities to our new class structure and the first look of our new class.
04:21
That was a beginning. This image is from the days that this class was just a proposal. The first implementation was looking like the image you see. This picture shows the main goals of the new class. Rendering the tiles on a canvas, having a UI tool for the UI elements like row headers in calc and
04:41
event handling. As you see in the in the picture, all the UI elements are on their places and if you resize the window with this technology, with the library we created, they will be moved to the edges so they will keep their relative positions all the time.
05:03
So this is a tiny UI library that we are using now. Also, the event handling is making this UI library work for the users too.
05:20
Features and challenges. And of course, there are some challenges we needed to overcome while we develop our library. For example, event propagation. It is easy to handle events if you have only one layer drawn onto accounts, but if there are overlapping elements and they need to handle the events separately, then it may be challenging.
05:43
Let me explain an example situation. We have tiles as a layer and shapes as another layer. A shape certainly overlaps with a part of the document. We also have scroll bars. At least two of these three objects overlap. The canvas section container needs to decide which section will handle the events in this case. All of them,
06:04
many of them, or only a sub-selection of them. We turned these challenges into features and now we are using the new class with many layers. And
06:22
for event propagation, this picture shows a tiny code piece from our implementation. Event handling is always some
06:46
some difficult, has always some difficult sides. Like when the mouse pointer moves outside of a layer while dragging, or mouse pointer can move to outside of the canvas element or even window. In these cases, some checks are required. After having these kinds of checks for mouse events,
07:03
we needed to have a look at the touch events. The library we had was checking if the device is touch-enabled or not. And this check sometimes makes difficult to use devices with both touch and mouse devices enabled. We unified the touch and click events in our library for solving this issue.
07:26
So we can now use our core library for handling touch events and mouse events at the same time. This is an image from our implementation.
07:53
Crisp images. This was the most challenging part. I spent quite a good time while implementing this and thanks to Michael and Candy for their mentoring.
08:02
Making the images look crisp on every device that Koloboro Online works was the main target of this library at first place. Because of window device pixel ratio property of the browser, that is a new, relatively new property, crisp images were difficult to render. This value is sometimes equal to something like
08:22
0.9 or so. We have tiles with dimensions 255 and 255 pixels. When we draw these tiles onto a device with device pixel ratio 2, they are drawn half-sized. We kept as the solution. For the solution, we kept the
08:43
height and width of our tiles and we increased the number of tiles when device pixel ratio is above 1. We also solved problems with floating-point numbers. In the end, the resolution of the document became good once again. This is
09:05
this picture, this image is from our UI of CALC and as you can see, we have now many sections drawn on the canvas elements. The side cursor,
09:22
scroll bar and row and column headers are all drawn objects onto a canvas element and they are handling their own events and users can see the tiles crisp again. Thank you for listening.