-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Improve heatmap rendering performance when zsmooth
is false
#6574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ab756a1
Improve heatmap rendering performance when `zsmooth` is false
lvlte e19f15d
Check browser support for pixelated image rendering.
lvlte 7b8106f
Update image baselines
lvlte 7ea2082
Update `KNOWN_GET_COMPUTED_STYLE_CALLS` (adding 1 call).
lvlte 85bc5e4
Add draft log
lvlte 0510f2f
Keep specific warnings
lvlte 1e9d6bd
Update draftlogs/6574_change.md
lvlte 6fb171f
Refactor: pixelated image rendering
lvlte c25484b
Refactor: pixelated image rendering (2)
lvlte 4eaf62e
Fix off-screen trace detection
lvlte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Improve heatmap rendering performance when `zsmooth` is set to false [[#6574](https://github.com/plotly/plotly.js/pull/6574)], with thanks to @lvlte for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
// Pixelated image rendering | ||
// The actual CSS declaration is prepended with fallbacks for older browsers. | ||
// NB. IE's `-ms-interpolation-mode` works only with <img> not with SVG <image> | ||
// https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering | ||
// https://caniuse.com/?search=image-rendering | ||
// http://phrogz.net/tmp/canvas_image_zoom.html | ||
|
||
exports.CSS_DECLARATIONS = [ | ||
['image-rendering', 'optimizeSpeed'], | ||
['image-rendering', '-moz-crisp-edges'], | ||
['image-rendering', '-o-crisp-edges'], | ||
['image-rendering', '-webkit-optimize-contrast'], | ||
['image-rendering', 'optimize-contrast'], | ||
['image-rendering', 'crisp-edges'], | ||
['image-rendering', 'pixelated'] | ||
]; | ||
|
||
exports.STYLE = exports.CSS_DECLARATIONS.map(function(d) { | ||
return d.join(': ') + '; '; | ||
}).join(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
var constants = require('../constants/pixelated_image'); | ||
var Drawing = require('../components/drawing'); | ||
var Lib = require('../lib'); | ||
|
||
var _supportsPixelated = null; | ||
|
||
/** | ||
* Check browser support for pixelated image rendering | ||
* | ||
* @return {boolean} | ||
*/ | ||
function supportsPixelatedImage() { | ||
if(_supportsPixelated !== null) { // only run the feature detection once | ||
return _supportsPixelated; | ||
} | ||
if(Lib.isIE()) { | ||
_supportsPixelated = false; | ||
} else { | ||
var declarations = Array.from(constants.CSS_DECLARATIONS).reverse(); | ||
var supports = window.CSS && window.CSS.supports || window.supportsCSS; | ||
if(typeof supports === 'function') { | ||
_supportsPixelated = declarations.some(function(d) { | ||
return supports.apply(null, d); | ||
}); | ||
} else { | ||
var image3 = Drawing.tester.append('image'); | ||
var cStyles = window.getComputedStyle(image3.node()); | ||
image3.attr('style', constants.STYLE); | ||
_supportsPixelated = declarations.some(function(d) { | ||
var value = d[1]; | ||
return cStyles.imageRendering === value || | ||
cStyles.imageRendering === value.toLowerCase(); | ||
}); | ||
image3.remove(); | ||
} | ||
} | ||
return _supportsPixelated; | ||
} | ||
|
||
module.exports = supportsPixelatedImage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.