Fix logo usage for metamask-logo v2.0.0

- No longer need to check for webGL compliance (svg rendered!)
- logo.canvas has been replaced with logo.container, since svg doesn't render to canvas but to an element.

Otherwise, worked with very little effort!!

Fixes #624
feature/default_network_editable
Dan Finlay 8 years ago
parent 452ce14fda
commit 20ae4c2689
  1. 2
      package.json
  2. 17
      ui/app/components/mascot.js

@ -51,7 +51,7 @@
"inject-css": "^0.1.1", "inject-css": "^0.1.1",
"jazzicon": "^1.1.3", "jazzicon": "^1.1.3",
"menu-droppo": "^1.1.0", "menu-droppo": "^1.1.0",
"metamask-logo": "^1.3.1", "metamask-logo": "^2.0.0",
"mississippi": "^1.2.0", "mississippi": "^1.2.0",
"multiplex": "^6.7.0", "multiplex": "^6.7.0",
"once": "^1.3.3", "once": "^1.3.3",

@ -14,7 +14,6 @@ function Mascot () {
pxNotRatio: true, pxNotRatio: true,
width: 200, width: 200,
height: 200, height: 200,
staticImage: './images/icon-512.png',
}) })
if (!this.logo.webGLSupport) return if (!this.logo.webGLSupport) return
this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000)
@ -27,28 +26,18 @@ Mascot.prototype.render = function () {
// and we dont get that until render // and we dont get that until render
this.handleAnimationEvents() this.handleAnimationEvents()
return ( return h('#metamask-mascot-container')
h('#metamask-mascot-container')
)
} }
Mascot.prototype.componentDidMount = function () { Mascot.prototype.componentDidMount = function () {
var targetDivId = 'metamask-mascot-container' var targetDivId = 'metamask-mascot-container'
var container = document.getElementById(targetDivId) var container = document.getElementById(targetDivId)
if (!this.logo.webGLSupport) { container.appendChild(this.logo.container)
var staticLogo = this.logo.staticLogo
staticLogo.style.marginBottom = '40px'
container.appendChild(staticLogo)
} else {
container.appendChild(this.logo.canvas)
}
} }
Mascot.prototype.componentWillUnmount = function () { Mascot.prototype.componentWillUnmount = function () {
if (!this.logo.webGLSupport) return if (!this.logo.webGLSupport) return
this.logo.canvas.remove() this.logo.container.remove()
} }
Mascot.prototype.handleAnimationEvents = function () { Mascot.prototype.handleAnimationEvents = function () {

Loading…
Cancel
Save