Skip to content

Subplot mode bars #258

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 21 commits into from
Feb 17, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
089b335
factor out isSelectable routine
etpinard Feb 11, 2016
fcdf05a
generalize is-active modebar update,
etpinard Feb 11, 2016
91ce34f
make dragmode and hovermode attribute of each scenes:
etpinard Feb 11, 2016
74e7e33
add fx and gl3d defaults tests
etpinard Feb 11, 2016
760bda3
don't show 3d hover labels when scene.hovermode is false
etpinard Feb 11, 2016
1180a8f
make 3d drag modebar button update scene.dragmode,
etpinard Feb 16, 2016
9010006
make camera modebar button update camera via fullLayou.scene?,
etpinard Feb 16, 2016
11189ae
make hover button extend current scene layout,
etpinard Feb 16, 2016
524ce13
use camera spec of own scene to init the camera,
etpinard Feb 16, 2016
9354fb3
rename scene.proto.handleDragmode --> scene.proto.updateFx
etpinard Feb 16, 2016
48d5957
lint
etpinard Feb 16, 2016
bc90474
add several 3d mode bar jasmine tests,
etpinard Feb 16, 2016
986e8b0
make modebar button assest abstraction more robust
etpinard Feb 16, 2016
fe0d8bb
add geo.proto.updateFx method:
etpinard Feb 16, 2016
0c5cf56
add multi-plot-type graphs mode bar button logic:
etpinard Feb 16, 2016
266caf0
generalize toggleHover mode bar button handler,
etpinard Feb 16, 2016
790bc73
add cartesian, geo and pie mode bar click handler tests
etpinard Feb 16, 2016
05a1b4f
bump down precision for circleCI
etpinard Feb 16, 2016
4babccb
make append buttons to add step more readable
etpinard Feb 17, 2016
9f3d14e
store previous scene state in button obj,
etpinard Feb 17, 2016
da5ea21
:cow2:
etpinard Feb 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
etpinard committed Feb 16, 2016
commit 48d5957b87c4a07ac30678a49d304eace6e5ee5a
1 change: 0 additions & 1 deletion src/components/modebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

var d3 = require('d3');

var Plotly = require('../../plotly');
var Lib = require('../../lib');
var Icons = require('../../../build/ploticon');

Expand Down
31 changes: 15 additions & 16 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,29 +598,28 @@ function cleanLayout(layout) {
* Clean up Scene layouts
*/
var sceneIds = Plots.getSubplotIds(layout, 'gl3d');
var scene, cameraposition, rotation,
radius, center, mat, eye;
for (i = 0; i < sceneIds.length; i++) {
scene = layout[sceneIds[i]];

/*
* Clean old Camera coords
*/
cameraposition = scene.cameraposition;
if (Array.isArray(cameraposition) && cameraposition[0].length === 4) {
rotation = cameraposition[0];
center = cameraposition[1];
radius = cameraposition[2];
mat = m4FromQuat([], rotation);
eye = [];
for (j = 0; j < 3; ++j) {
for(i = 0; i < sceneIds.length; i++) {
var scene = layout[sceneIds[i]];

// clean old Camera coords
var cameraposition = scene.cameraposition;
if(Array.isArray(cameraposition) && cameraposition[0].length === 4) {
var rotation = cameraposition[0],
center = cameraposition[1],
radius = cameraposition[2],
mat = m4FromQuat([], rotation),
eye = [];

for(j = 0; j < 3; ++j) {
eye[j] = center[i] + radius * mat[2 + 4 * j];
}

scene.camera = {
eye: {x: eye[0], y: eye[1], z: eye[2]},
center: {x: center[0], y: center[1], z: center[2]},
up: {x: mat[1], y: mat[5], z: mat[9]}
};

delete scene.cameraposition;
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/plots/cartesian/graph_interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var tinycolor = require('tinycolor2');
var isNumeric = require('fast-isnumeric');

var Plotly = require('../../plotly');
var Lib = require('../../lib');
var Events = require('../../lib/events');

var prepSelect = require('./select');
Expand Down Expand Up @@ -43,20 +44,17 @@ fx.layoutAttributes = {
};

fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) {
var isHoriz, hovermodeDflt;

function coerce(attr, dflt) {
return Plotly.Lib.coerce(layoutIn, layoutOut,
fx.layoutAttributes,
attr, dflt);
return Lib.coerce(layoutIn, layoutOut, fx.layoutAttributes, attr, dflt);
}

coerce('dragmode');

var hovermodeDflt;
if(layoutOut._hasCartesian) {
// flag for 'horizontal' plots:
// determines the state of the mode bar 'compare' hovermode button
isHoriz = layoutOut._isHoriz = fx.isHoriz(fullData);
var isHoriz = layoutOut._isHoriz = fx.isHoriz(fullData);
hovermodeDflt = isHoriz ? 'y' : 'x';
}
else hovermodeDflt = 'closest';
Expand All @@ -66,14 +64,16 @@ fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) {

fx.isHoriz = function(fullData) {
var isHoriz = true;
var i, trace;
for (i = 0; i < fullData.length; i++) {
trace = fullData[i];
if (trace.orientation !== 'h') {

for(var i = 0; i < fullData.length; i++) {
var trace = fullData[i];

if(trace.orientation !== 'h') {
isHoriz = false;
break;
}
}

return isHoriz;
};

Expand Down
1 change: 0 additions & 1 deletion src/plots/gl3d/layout/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {

var isValid = layoutAttributes[attr].values.indexOf(layoutIn[attr]) !== -1;

var dflt;
if(isOnlyGL3D && isValid) return layoutIn[attr];
}

Expand Down
3 changes: 2 additions & 1 deletion src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) {

try {
scene.glplot = createPlot(glplotOptions);
} catch (e) {
}
catch (e) {
/*
* createPlot will throw when webgl is not enabled in the client.
* Lets return an instance of the module with all functions noop'd.
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/gl3dlayout_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var Gl3d = require('@src/plots/gl3d');


fdescribe('Test Gl3d layout defaults', function() {
describe('Test Gl3d layout defaults', function() {
'use strict';

describe('supplyLayoutDefaults', function() {
Expand Down