From 43e28788d7763de61d5190e8cca406077b8bdd9a Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 19 Aug 2016 14:47:49 -0700 Subject: Create replacement logo for non-webgl --- ui/app/components/mascot.js | 10 ++++++++-- ui/app/unlock.js | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index ddd51f8ba..e99720e1b 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -34,10 +34,16 @@ Mascot.prototype.render = function () { } Mascot.prototype.componentDidMount = function () { - if (!this.logo) return var targetDivId = 'metamask-mascot-container' var container = document.getElementById(targetDivId) - container.appendChild(this.logo.canvas) + if (!this.logo) { + var staticLogo = document.createElement('img') + staticLogo.src = 'images/icon-128.png' + staticLogo.style.marginBottom = '20px' + container.appendChild(staticLogo) + } else { + container.appendChild(this.logo.canvas) + } } Mascot.prototype.componentWillUnmount = function () { diff --git a/ui/app/unlock.js b/ui/app/unlock.js index a7896d640..7cc1699c3 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -3,10 +3,11 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') -const Mascot = require('./components/mascot') const getCaretCoordinates = require('textarea-caret') const EventEmitter = require('events').EventEmitter +const Mascot = require('./components/mascot') + module.exports = connect(mapStateToProps)(UnlockScreen) inherits(UnlockScreen, Component) -- cgit v1.2.3 From 7a466697d30019a4a1703a19b60ecc78fd063f5d Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 19 Aug 2016 16:59:04 -0700 Subject: Modify logic for component update. --- ui/app/components/mascot.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index e99720e1b..b13e130c2 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -15,7 +15,7 @@ function Mascot () { width: 200, height: 200, }) - if (!this.logo) return + if (!this.logo.webGLSupport) return this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false) } @@ -36,10 +36,9 @@ Mascot.prototype.render = function () { Mascot.prototype.componentDidMount = function () { var targetDivId = 'metamask-mascot-container' var container = document.getElementById(targetDivId) - if (!this.logo) { - var staticLogo = document.createElement('img') - staticLogo.src = 'images/icon-128.png' - staticLogo.style.marginBottom = '20px' + if (!this.logo.webGLSupport) { + var staticLogo = this.logo.staticLogo + staticLogo.style.marginBottom = '40px' container.appendChild(staticLogo) } else { container.appendChild(this.logo.canvas) -- cgit v1.2.3 From 5168232481849019d00756139b3cfc7b6a93a1f3 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 23 Aug 2016 14:11:25 -0700 Subject: Created option to pass in static file for fallback for logo. --- ui/app/components/mascot.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index b13e130c2..28a6e735f 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -14,7 +14,9 @@ function Mascot () { pxNotRatio: true, width: 200, height: 200, + staticImage: './images/icon-512.png' }) + debugger; if (!this.logo.webGLSupport) return this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false) @@ -46,12 +48,12 @@ Mascot.prototype.componentDidMount = function () { } Mascot.prototype.componentWillUnmount = function () { - if (!this.logo) return + if (!this.logo.webGLSupport) return this.logo.canvas.remove() } Mascot.prototype.handleAnimationEvents = function () { - if (!this.logo) return + if (!this.logo.webGLSupport) return // only setup listeners once if (this.animations) return this.animations = this.props.animationEventEmitter @@ -60,7 +62,7 @@ Mascot.prototype.handleAnimationEvents = function () { } Mascot.prototype.lookAt = function (target) { - if (!this.logo) return + if (!this.logo.webGLSupport) return this.unfollowMouse() this.logo.lookAt(target) this.refollowMouse() -- cgit v1.2.3 From 6363a80b49fc9ae7ba168bbd8416fddf0ac75557 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 23 Aug 2016 14:32:12 -0700 Subject: Linting. --- ui/app/components/mascot.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index 28a6e735f..f2b00262b 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -14,9 +14,8 @@ function Mascot () { pxNotRatio: true, width: 200, height: 200, - staticImage: './images/icon-512.png' + staticImage: './images/icon-512.png', }) - debugger; if (!this.logo.webGLSupport) return this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false) -- cgit v1.2.3