From fb7eae8473f9acda40f3112add390030f02ac8bf Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sat, 22 Mar 2014 19:07:57 +0000 Subject: [PATCH] don't enable canvas rendering by default. add a plugin to change the setting instead --- main.js | 2 +- plugins/canvas-render.user.js | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 plugins/canvas-render.user.js diff --git a/main.js b/main.js index c4ae0f5f..6a4146ff 100644 --- a/main.js +++ b/main.js @@ -130,7 +130,7 @@ try { // Disabled for now because it has several bugs: flickering, constant // CPU usage and it continuously fires the moveend event. -L_PREFER_CANVAS = true; +//L_PREFER_CANVAS = false; // CONFIG OPTIONS //////////////////////////////////////////////////// window.REFRESH = 30; // refresh view every 30s (base time) diff --git a/plugins/canvas-render.user.js b/plugins/canvas-render.user.js new file mode 100644 index 00000000..63bf9e1d --- /dev/null +++ b/plugins/canvas-render.user.js @@ -0,0 +1,44 @@ +// ==UserScript== +// @id iitc-plugin-canvas-render@jonatkins +// @name IITC plugin: Use Canvas rendering +// @category Tweaks +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] EXPERIMENTAL: use canvas-based rendering. Can be faster when viewing dense areas. Limited testing of the feature so far +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// @grant none +// ==/UserScript== + +@@PLUGINSTART@@ + +// PLUGIN START //////////////////////////////////////////////////////// + +// we need this global variable set before leaflet initialises +L_PREFER_CANVAS = true; + +// use own namespace for plugin +window.plugin.canvasRendering = function() {}; + +window.plugin.canvasRendering.setup = function() { + + // nothing we can do here - other than check that canvas rendering was enabled + if (!L.Path.CANVAS) { + dialog({ + title:'Canvas Render Warning', + text:'The Canvas Rendering plugin failed to enable canvas rendering in leaflet. This will occur if it initialises too late.\n' + +'Try re-ordering userscripts so Canvas Rendering is before the main IITC script.' + }); + } + +}; + +var setup = window.plugin.canvasRendering.setup; + +// PLUGIN END ////////////////////////////////////////////////////////// + +@@PLUGINEND@@