conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
/*
* @class Handler for loading entities into engine
* @extends ConfigHandler
* @param {World} world
* @param {Function} getConfig
* @param {Function} updateObject
*/
=======
/**
* @class
* @private
*/
>>>>>>>
/**
* @class Handler for loading entities into engine
* @extends ConfigHandler
* @param {World} world
* @param {Function} getConfig
* @param {Function} updateObject
* @private
*/ |
<<<<<<<
'goo/math/Matrix3',
'goo/math/Matrix4',
=======
'goo/math/Matrix3x3',
'goo/math/Matrix4x4',
'goo/math/Vector2',
>>>>>>>
'goo/math/Matrix3',
'goo/math/Matrix4',
'goo/math/Vector2',
<<<<<<<
Matrix3,
Matrix4,
=======
Matrix3x3,
Matrix4x4,
Vector2,
>>>>>>>
Matrix3,
Matrix4,
Vector2,
<<<<<<<
];
/*
var camera = this.camera;
if (camera && camera.projectionMode === Camera.Parallel){
mousePos[0] = x / (this.viewportWidth / this._devicePixelRatio) / (camera._frustumRight - camera._frustumLeft);
mousePos[1] = y / (this.viewportHeight / this._devicePixelRatio) / (camera._frustumTop - camera._frustumBottom);
}
console.log(mousePos[0], mousePos[1])
*/
this.activeGizmo.update(mousePos);
=======
);
this._dirty = true;
>>>>>>>
);
this._dirty = true;
<<<<<<<
// Set bound entities translation
this.gizmos[0].onChange = function (change) {
if (this.entity) {
var translation = this.entity.transformComponent.transform.translation;
translation.set(change);
if (this.entity.transformComponent.parent) {
inverseTransformation.copy(this.entity.transformComponent.parent.worldTransform.matrix);
inverseTransformation.invert();
inverseTransformation.applyPostPoint(translation);
}
this.entity.transformComponent.setUpdated();
=======
var onTranslationChange = function (change) {
if (!this.entity) { return; }
var translation = this.entity.transformComponent.transform.translation;
translation.copy(change);
if (this.entity.transformComponent.parent) {
inverseTransformation.copy(this.entity.transformComponent.parent.worldTransform.matrix);
inverseTransformation.invert();
inverseTransformation.applyPostPoint(translation);
>>>>>>>
var onTranslationChange = function (change) {
if (!this.entity) { return; }
var translation = this.entity.transformComponent.transform.translation;
translation.copy(change);
if (this.entity.transformComponent.parent) {
inverseTransformation.copy(this.entity.transformComponent.parent.worldTransform.matrix);
inverseTransformation.invert();
translation.applyPostPoint(inverseTransformation);
<<<<<<<
this.gizmos[2].onChange = function (change) {
if (this.entity) {
var scale = this.entity.transformComponent.transform.scale;
scale.set(change);
if (this.entity.transformComponent.parent) {
scale.div(this.entity.transformComponent.parent.worldTransform.scale);
}
this.entity.transformComponent.setUpdated();
=======
this.gizmos[4].onChange = function (change) {
if (!this.entity) { return; }
var scale = this.entity.transformComponent.transform.scale;
scale.copy(change);
if (this.entity.transformComponent.parent) {
scale.div(this.entity.transformComponent.parent.worldTransform.scale);
>>>>>>>
this.gizmos[4].onChange = function (change) {
if (!this.entity) { return; }
var scale = this.entity.transformComponent.transform.scale;
scale.copy(change);
if (this.entity.transformComponent.parent) {
scale.div(this.entity.transformComponent.parent.worldTransform.scale); |
<<<<<<<
HEX_ICON: '/assets/icons/hex-icon-dark.svg',
HEX_ICON_DARK: '/assets/icons/hex-icon-dark.svg',
=======
XHT_ICON: '/assets/icons/xht-icon.svg',
XHT_ICON_DARK: '/assets/icons/xht-icon-dark.svg',
>>>>>>>
XHT_ICON: '/assets/icons/xht-icon.svg',
XHT_ICON_DARK: '/assets/icons/xht-icon-dark.svg',
<<<<<<<
HEX_LOGO_LIGHT:'/assets/icons/HEX-logo-light.svg',
HEX_LOGO_DARK:'/assets/icons/HEX-logo-dark.svg',
BONUS_OFFERING:'/assets/icons/bonus_offering.svg',
=======
XHT_LOGO_LIGHT:'/assets/icons/XHT-logo-light.svg',
XHT_LOGO_DARK:'/assets/icons/XHT-logo-dark.svg',
>>>>>>>
XHT_LOGO_LIGHT:'/assets/icons/XHT-logo-light.svg',
XHT_LOGO_DARK:'/assets/icons/XHT-logo-dark.svg',
BONUS_OFFERING:'/assets/icons/bonus_offering.svg', |
<<<<<<<
/*Object.defineProperty(this, 'id', {
=======
//! AT: not sure if this tags/attributes abstraction is really needed or if they are just glorified properties
this._tags = {};
this._attributes = {};
Object.defineProperty(this, 'id', {
>>>>>>>
//! AT: not sure if this tags/attributes abstraction is really needed or if they are just glorified properties
this._tags = {};
this._attributes = {};
/*Object.defineProperty(this, 'id', { |
<<<<<<<
PhysicsSystem.prototype.raycastAll = function (start, direction, distance, options, callback) {
if (typeof options === 'function') {
=======
PhysicsSystem.prototype.raycastAll = function (start, direction, maxDistance, options, callback) {
if (typeof(options) === 'function') {
>>>>>>>
PhysicsSystem.prototype.raycastAll = function (start, direction, maxDistance, options, callback) {
if (typeof options === 'function') { |
<<<<<<<
return store;
}
},
order: [
0, 4, 8, 12,
1, 5, 9, 13,
2, 6, 10, 14
],
prevertex: [
'#ifdef JOINTIDS',
'attribute vec4 vertexJointIDs;',
'#endif',
'#ifdef WEIGHTS',
'attribute vec4 vertexWeights;',
'#endif',
'#ifdef JOINT_COUNT',
'uniform vec4 jointPalette[JOINT_COUNT];',
'#endif'
].join('\n'),
vertex: [
'#if defined(JOINT_COUNT) && defined(WEIGHTS) && defined(JOINTIDS)',
'int x = 3*int(vertexJointIDs.x);',
'int y = 3*int(vertexJointIDs.y);',
'int z = 3*int(vertexJointIDs.z);',
'int w = 3*int(vertexJointIDs.w);',
'mat4 mat = mat4(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);',
'mat += mat4(',
' jointPalette[x+0].x, jointPalette[x+1].x, jointPalette[x+2].x, 0,',
' jointPalette[x+0].y, jointPalette[x+1].y, jointPalette[x+2].y, 0,',
' jointPalette[x+0].z, jointPalette[x+1].z, jointPalette[x+2].z, 0,',
' jointPalette[x+0].w, jointPalette[x+1].w, jointPalette[x+2].w, 1',
') * vertexWeights.x;',
'mat += mat4(',
' jointPalette[y+0].x, jointPalette[y+1].x, jointPalette[y+2].x, 0,',
' jointPalette[y+0].y, jointPalette[y+1].y, jointPalette[y+2].y, 0,',
' jointPalette[y+0].z, jointPalette[y+1].z, jointPalette[y+2].z, 0,',
' jointPalette[y+0].w, jointPalette[y+1].w, jointPalette[y+2].w, 1',
') * vertexWeights.y;',
'mat += mat4(',
' jointPalette[z+0].x, jointPalette[z+1].x, jointPalette[z+2].x, 0,',
' jointPalette[z+0].y, jointPalette[z+1].y, jointPalette[z+2].y, 0,',
' jointPalette[z+0].z, jointPalette[z+1].z, jointPalette[z+2].z, 0,',
' jointPalette[z+0].w, jointPalette[z+1].w, jointPalette[z+2].w, 1',
') * vertexWeights.z;',
'mat += mat4(',
' jointPalette[w+0].x, jointPalette[w+1].x, jointPalette[w+2].x, 0,',
' jointPalette[w+0].y, jointPalette[w+1].y, jointPalette[w+2].y, 0,',
' jointPalette[w+0].z, jointPalette[w+1].z, jointPalette[w+2].z, 0,',
' jointPalette[w+0].w, jointPalette[w+1].w, jointPalette[w+2].w, 1',
') * vertexWeights.w;',
'wMatrix = wMatrix * mat / mat[3][3];',
'#ifdef NORMAL',
'nMatrix = nMatrix * mat3(mat) / mat[3][3];',
'#endif',
'#endif'
].join('\n')
};
module.exports = ShaderBuilder;
=======
},
order: [
0, 4, 8, 12,
1, 5, 9, 13,
2, 6, 10, 14
],
prevertex: [
'#if defined(JOINT_COUNT) && defined(WEIGHTS) && defined(JOINTIDS)',
'attribute vec4 vertexJointIDs;',
'attribute vec4 vertexWeights;',
'uniform vec4 jointPalette[JOINT_COUNT];',
'#endif'
].join('\n'),
vertex: [
'#if defined(JOINT_COUNT) && defined(WEIGHTS) && defined(JOINTIDS)',
'int x = 3*int(vertexJointIDs.x);',
'int y = 3*int(vertexJointIDs.y);',
'int z = 3*int(vertexJointIDs.z);',
'int w = 3*int(vertexJointIDs.w);',
'mat4 mat = mat4(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);',
'mat += mat4(',
' jointPalette[x+0].x, jointPalette[x+1].x, jointPalette[x+2].x, 0,',
' jointPalette[x+0].y, jointPalette[x+1].y, jointPalette[x+2].y, 0,',
' jointPalette[x+0].z, jointPalette[x+1].z, jointPalette[x+2].z, 0,',
' jointPalette[x+0].w, jointPalette[x+1].w, jointPalette[x+2].w, 1',
') * vertexWeights.x;',
'mat += mat4(',
' jointPalette[y+0].x, jointPalette[y+1].x, jointPalette[y+2].x, 0,',
' jointPalette[y+0].y, jointPalette[y+1].y, jointPalette[y+2].y, 0,',
' jointPalette[y+0].z, jointPalette[y+1].z, jointPalette[y+2].z, 0,',
' jointPalette[y+0].w, jointPalette[y+1].w, jointPalette[y+2].w, 1',
') * vertexWeights.y;',
'mat += mat4(',
' jointPalette[z+0].x, jointPalette[z+1].x, jointPalette[z+2].x, 0,',
' jointPalette[z+0].y, jointPalette[z+1].y, jointPalette[z+2].y, 0,',
' jointPalette[z+0].z, jointPalette[z+1].z, jointPalette[z+2].z, 0,',
' jointPalette[z+0].w, jointPalette[z+1].w, jointPalette[z+2].w, 1',
') * vertexWeights.z;',
'mat += mat4(',
' jointPalette[w+0].x, jointPalette[w+1].x, jointPalette[w+2].x, 0,',
' jointPalette[w+0].y, jointPalette[w+1].y, jointPalette[w+2].y, 0,',
' jointPalette[w+0].z, jointPalette[w+1].z, jointPalette[w+2].z, 0,',
' jointPalette[w+0].w, jointPalette[w+1].w, jointPalette[w+2].w, 1',
') * vertexWeights.w;',
'wMatrix = wMatrix * mat / mat[3][3];',
'#ifdef NORMAL',
'nMatrix = nMatrix * mat3(mat) / mat[3][3];',
'#endif',
'#endif'
].join('\n')
};
return ShaderBuilder;
});
>>>>>>>
return store;
}
},
order: [
0, 4, 8, 12,
1, 5, 9, 13,
2, 6, 10, 14
],
prevertex: [
'#if defined(JOINT_COUNT) && defined(WEIGHTS) && defined(JOINTIDS)',
'attribute vec4 vertexJointIDs;',
'attribute vec4 vertexWeights;',
'uniform vec4 jointPalette[JOINT_COUNT];',
'#endif'
].join('\n'),
vertex: [
'#if defined(JOINT_COUNT) && defined(WEIGHTS) && defined(JOINTIDS)',
'int x = 3*int(vertexJointIDs.x);',
'int y = 3*int(vertexJointIDs.y);',
'int z = 3*int(vertexJointIDs.z);',
'int w = 3*int(vertexJointIDs.w);',
'mat4 mat = mat4(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);',
'mat += mat4(',
' jointPalette[x+0].x, jointPalette[x+1].x, jointPalette[x+2].x, 0,',
' jointPalette[x+0].y, jointPalette[x+1].y, jointPalette[x+2].y, 0,',
' jointPalette[x+0].z, jointPalette[x+1].z, jointPalette[x+2].z, 0,',
' jointPalette[x+0].w, jointPalette[x+1].w, jointPalette[x+2].w, 1',
') * vertexWeights.x;',
'mat += mat4(',
' jointPalette[y+0].x, jointPalette[y+1].x, jointPalette[y+2].x, 0,',
' jointPalette[y+0].y, jointPalette[y+1].y, jointPalette[y+2].y, 0,',
' jointPalette[y+0].z, jointPalette[y+1].z, jointPalette[y+2].z, 0,',
' jointPalette[y+0].w, jointPalette[y+1].w, jointPalette[y+2].w, 1',
') * vertexWeights.y;',
'mat += mat4(',
' jointPalette[z+0].x, jointPalette[z+1].x, jointPalette[z+2].x, 0,',
' jointPalette[z+0].y, jointPalette[z+1].y, jointPalette[z+2].y, 0,',
' jointPalette[z+0].z, jointPalette[z+1].z, jointPalette[z+2].z, 0,',
' jointPalette[z+0].w, jointPalette[z+1].w, jointPalette[z+2].w, 1',
') * vertexWeights.z;',
'mat += mat4(',
' jointPalette[w+0].x, jointPalette[w+1].x, jointPalette[w+2].x, 0,',
' jointPalette[w+0].y, jointPalette[w+1].y, jointPalette[w+2].y, 0,',
' jointPalette[w+0].z, jointPalette[w+1].z, jointPalette[w+2].z, 0,',
' jointPalette[w+0].w, jointPalette[w+1].w, jointPalette[w+2].w, 1',
') * vertexWeights.w;',
'wMatrix = wMatrix * mat / mat[3][3];',
'#ifdef NORMAL',
'nMatrix = nMatrix * mat3(mat) / mat[3][3];',
'#endif',
'#endif'
].join('\n')
};
module.exports = ShaderBuilder; |
<<<<<<<
world.registerComponent(RigidbodyComponent);
goo.setRenderSystem(new PhysicsDebugRenderSystem());
=======
world.registerComponent(RigidBodyComponent);
>>>>>>>
world.registerComponent(RigidBodyComponent);
goo.setRenderSystem(new PhysicsDebugRenderSystem()); |
<<<<<<<
define([
'goo/math/Vector3',
'goo/math/MathUtils'
],
/** @lends */
function (
Vector3,
MathUtils
) {
=======
define([
'goo/math/Vector3',
'goo/math/MathUtils'
], function (
Vector3,
MathUtils
) {
>>>>>>>
define([
'goo/math/Vector3',
'goo/math/MathUtils'
], function (
Vector3,
MathUtils
) {
<<<<<<<
this.origin = origin ? origin.clone() : new Vector3();
this.direction = direction ? direction.clone() : Vector3.UNIT_Z.clone();
=======
this.origin = origin || new Vector3();
this.direction = direction || new Vector3().copy(Vector3.UNIT_Z);
// #ifdef DEBUG
Object.seal(this);
// #endif
>>>>>>>
this.origin = origin ? origin.clone() : new Vector3();
this.direction = direction ? direction.clone() : Vector3.UNIT_Z.clone();
// #ifdef DEBUG
Object.seal(this);
// #endif |
<<<<<<<
if(!environment.panDirty) {
return;
}
=======
if(!environment.dirty) { return ;}
>>>>>>>
if(!environment.dirty) {
return;
}
<<<<<<<
var entity = environment.entity;
=======
var entity = environment.entity;
var transform = entity.transformComponent.transform;
>>>>>>>
var entity = environment.entity;
var transform = entity.transformComponent.transform;
<<<<<<<
console.log(mouseState.dx, mouseState.dy)
=======
>>>>>>>
console.log(mouseState.dx, mouseState.dy)
<<<<<<<
calcVector.scale((camera._frustumTop - camera._frustumBottom) / environment.viewportHeight);
calcVector2.scale((camera._frustumRight - camera._frustumLeft) / environment.viewportWidth);
//}
=======
calcVector.scale(2*camera._frustumTop / (environment.viewportHeight/devicePixelRatio));
calcVector2.scale(2*camera._frustumRight / (environment.viewportWidth/devicePixelRatio));
}
>>>>>>>
calcVector.scale((camera._frustumTop - camera._frustumBottom) / environment.viewportHeight);
calcVector2.scale((camera._frustumRight - camera._frustumLeft) / environment.viewportWidth);
//} |
<<<<<<<
'goo/addons/physicspack/systems/PhysicsDebugRenderSystem',
'goo/addons/physicspack/components/AbstractRigidbodyComponent',
=======
'goo/addons/physicspack/components/AbstractRigidBodyComponent',
>>>>>>>
'goo/addons/physicspack/systems/PhysicsDebugRenderSystem',
'goo/addons/physicspack/components/AbstractRigidbodyComponent',
<<<<<<<
'goo/addons/physicspack/components/RigidbodyComponent',
'goo/addons/physicspack/shapes/PhysicsPlaneDebugShape'
=======
'goo/addons/physicspack/components/RigidBodyComponent'
>>>>>>>
'goo/addons/physicspack/components/RigidBodyComponent',
'goo/addons/physicspack/shapes/PhysicsPlaneDebugShape'
<<<<<<<
'goo/addons/physicspack/systems/PhysicsDebugRenderSystem',
'goo/addons/physicspack/components/AbstractRigidbodyComponent',
=======
'goo/addons/physicspack/components/AbstractRigidBodyComponent',
>>>>>>>
'goo/addons/physicspack/systems/PhysicsDebugRenderSystem',
'goo/addons/physicspack/components/AbstractRigidBodyComponent',
<<<<<<<
'goo/addons/physicspack/components/RigidbodyComponent',
'goo/addons/physicspack/shapes/PhysicsPlaneDebugShape'
=======
'goo/addons/physicspack/components/RigidBodyComponent'
>>>>>>>
'goo/addons/physicspack/components/RigidBodyComponent',
'goo/addons/physicspack/shapes/PhysicsPlaneDebugShape' |
<<<<<<<
renderables.forEach(function (renderable) {
renderable.transform.translation.set(entity.transformComponent.worldTransform.translation);
=======
for (var k = 0; k < renderables.length; k++) {
var renderable = renderables[k];
renderable.transform.translation.setVector(entity.transformComponent.worldTransform.translation);
>>>>>>>
for (var k = 0; k < renderables.length; k++) {
var renderable = renderables[k];
renderable.transform.translation.set(entity.transformComponent.worldTransform.translation); |
<<<<<<<
'test/addons/physicspack/systems/PhysicsDebugRenderSystem-test',
'test/addons/physicspack/components/RigidbodyComponent-test',
=======
'test/addons/physicspack/components/RigidBodyComponent-test',
>>>>>>>
'test/addons/physicspack/systems/PhysicsDebugRenderSystem-test',
'test/addons/physicspack/components/RigidBodyComponent-test',
<<<<<<<
'test/addons/physicspack/util/Pool-test',
=======
'test/addons/physicspack/handlers/ColliderComponentHandler-test',
'test/addons/physicspack/handlers/RigidBodyComponentHandler-test',
>>>>>>>
'test/addons/physicspack/util/Pool-test', |
<<<<<<<
return angle;
};
/**
* Clones the quaternion
* @returns {Quaternion} Clone of self
*/
Quaternion.prototype.clone = function () {
return new Quaternion(this.x, this.y, this.z, this.w);
};
/**
* Calculates the dot product between the current quaternion and another quaternion.
* @param rhs Quaternion on the right-hand side.
* @returns {number} The dot product.
*/
Quaternion.prototype.dot = function (q) {
return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w;
};
// @ifdef DEBUG
Vector.addReturnChecks(Quaternion.prototype, [
'dot', 'dotDirect',
'length', 'lengthSquared',
'distance', 'distanceSquared'
]);
// @endif
/**
* Sets the vector's values from 4 numeric arguments
* @param {number} x
* @param {number} y
* @param {number} z
* @param {number} w
* @returns {Quaternion} Self to allow chaining
* @example
* var q = new Quaternion(); // q == (0, 0, 0, 0)
* q.setDirect(2, 4, 6, 8); // q == (2, 4, 6, 8)
*/
Quaternion.prototype.setDirect = function (x, y, z, w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
return this;
};
// SHIM START
Object.defineProperty(Quaternion.prototype, 'data', {
get: ObjectUtils.warnOnce(
'The .data property of Quaternion was removed. Please use the .x, .y, .z and .w properties instead.',
function () {
var data = [];
var that = this;
Object.defineProperties(data, {
'0': {
get: function () {
return that.x;
=======
return angle;
};
/**
* Clones the quaternion
* @returns {Quaternion} Clone of self
*/
Quaternion.prototype.clone = function () {
return new Quaternion(this.x, this.y, this.z, this.w);
};
/**
* Calculates the dot product between the current quaternion and another quaternion.
* @param rhs Quaternion on the right-hand side.
* @returns {number} The dot product.
*/
Quaternion.prototype.dot = function (q) {
return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w;
};
// #ifdef DEBUG
Vector.addReturnChecks(Quaternion.prototype, [
'dot', 'dotDirect',
'length', 'lengthSquared',
'distance', 'distanceSquared'
]);
// #endif
/**
* Sets the vector's values from 4 numeric arguments
* @param {number} x
* @param {number} y
* @param {number} z
* @param {number} w
* @returns {Quaternion} Self to allow chaining
* @example
* var q = new Quaternion(); // q == (0, 0, 0, 0)
* q.setDirect(2, 4, 6, 8); // q == (2, 4, 6, 8)
*/
Quaternion.prototype.setDirect = function (x, y, z, w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
return this;
};
/**
* Set the quaternion components from an array (ordered x, y, z, w).
* @param {array} array
* @return {Quaternion} The self object.
*/
Quaternion.prototype.setArray = function (array) {
this.x = array[0];
this.y = array[1];
this.z = array[2];
this.w = array[3];
return this;
};
// SHIM START
Object.defineProperty(Quaternion.prototype, 'data', {
get: ObjectUtils.warnOnce(
'The .data property of Quaternion was removed. Please use the .x, .y, .z and .w properties instead.',
function () {
var data = [];
var that = this;
Object.defineProperties(data, {
'0': {
get: function () {
return that.x;
},
set: function (value) {
that.x = value;
}
>>>>>>>
return angle;
};
/**
* Clones the quaternion
* @returns {Quaternion} Clone of self
*/
Quaternion.prototype.clone = function () {
return new Quaternion(this.x, this.y, this.z, this.w);
};
/**
* Calculates the dot product between the current quaternion and another quaternion.
* @param rhs Quaternion on the right-hand side.
* @returns {number} The dot product.
*/
Quaternion.prototype.dot = function (q) {
return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w;
};
// #ifdef DEBUG
Vector.addReturnChecks(Quaternion.prototype, [
'dot', 'dotDirect',
'length', 'lengthSquared',
'distance', 'distanceSquared'
]);
// #endif
/**
* Sets the vector's values from 4 numeric arguments
* @param {number} x
* @param {number} y
* @param {number} z
* @param {number} w
* @returns {Quaternion} Self to allow chaining
* @example
* var q = new Quaternion(); // q == (0, 0, 0, 0)
* q.setDirect(2, 4, 6, 8); // q == (2, 4, 6, 8)
*/
Quaternion.prototype.setDirect = function (x, y, z, w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
return this;
};
/**
* Set the quaternion components from an array (ordered x, y, z, w).
* @param {array} array
* @return {Quaternion} The self object.
*/
Quaternion.prototype.setArray = function (array) {
this.x = array[0];
this.y = array[1];
this.z = array[2];
this.w = array[3];
return this;
};
// SHIM START
Object.defineProperty(Quaternion.prototype, 'data', {
get: ObjectUtils.warnOnce(
'The .data property of Quaternion was removed. Please use the .x, .y, .z and .w properties instead.',
function () {
var data = [];
var that = this;
Object.defineProperties(data, {
'0': {
get: function () {
return that.x;
<<<<<<<
return target;
}
);
/**
* @hidden
* @deprecated
*/
Quaternion.scalarMul = ObjectUtils.warnOnce(
'Quaternion.scalarMul is deprecated.',
function (lhs, rhs, target) {
if (!target) {
target = new Quaternion();
}
target.x = lhs.x * rhs;
target.y = lhs.y * rhs;
target.z = lhs.z * rhs;
target.w = lhs.w * rhs;
=======
/**
* @hidden
* @deprecated
*/
Quaternion.prototype.setVector = ObjectUtils.warnOnce(
'Quaternion.prototype.setVector is deprecated.',
function (quat) {
this.x = quat.x;
this.y = quat.y;
this.z = quat.z;
this.w = quat.w;
return this;
}
);
>>>>>>>
return target;
}
);
/**
* @hidden
* @deprecated
*/
Quaternion.scalarMul = ObjectUtils.warnOnce(
'Quaternion.scalarMul is deprecated.',
function (lhs, rhs, target) {
if (!target) {
target = new Quaternion();
}
target.x = lhs.x * rhs;
target.y = lhs.y * rhs;
target.z = lhs.z * rhs;
target.w = lhs.w * rhs; |
<<<<<<<
module.exports = ScaleAction;
=======
ScaleAction.prototype.enter = function (fsm) {
if (!this.everyFrame) {
this.applyScale(fsm);
}
};
ScaleAction.prototype.update = function (fsm) {
if (this.everyFrame) {
this.applyScale(fsm);
}
};
return ScaleAction;
});
>>>>>>>
ScaleAction.prototype.enter = function (fsm) {
if (!this.everyFrame) {
this.applyScale(fsm);
}
};
ScaleAction.prototype.update = function (fsm) {
if (this.everyFrame) {
this.applyScale(fsm);
}
};
module.exports = ScaleAction; |
<<<<<<<
RigidBodyComponent.copyScaleFromColliderToCannonShape = function (cannonShape, collider) {
if (collider instanceof SphereCollider) {
cannonShape.radius = collider.radius;
} else if (collider instanceof BoxCollider) {
cannonShape.halfExtents.copy(collider.halfExtents);
} else if (collider instanceof MeshCollider) {
var scale = new CANNON.Vec3();
scale.copy(collider.scale);
cannonShape.setScale(scale);
}
cannonShape.updateBoundingSphereRadius();
};
=======
/**
* @hidden
*/
>>>>>>>
RigidBodyComponent.copyScaleFromColliderToCannonShape = function (cannonShape, collider) {
if (collider instanceof SphereCollider) {
cannonShape.radius = collider.radius;
} else if (collider instanceof BoxCollider) {
cannonShape.halfExtents.copy(collider.halfExtents);
} else if (collider instanceof MeshCollider) {
var scale = new CANNON.Vec3();
scale.copy(collider.scale);
cannonShape.setScale(scale);
}
cannonShape.updateBoundingSphereRadius();
};
/**
* @hidden
*/ |
<<<<<<<
tmpVec.set(a.scale).mul(b.scale);
this.scale.set(tmpVec);
=======
tmpVec.setVector(a.scale).mulVector(b.scale);
this.scale.setVector(tmpVec);
return this;
>>>>>>>
tmpVec.set(a.scale).mul(b.scale);
this.scale.set(tmpVec);
return this;
<<<<<<<
this.scale.set(Vector3.ONE);
=======
this.scale.setVector(Vector3.ONE);
return this;
>>>>>>>
this.scale.set(Vector3.ONE);
return this;
<<<<<<<
this.scale.set(transform.scale);
=======
this.scale.setVector(transform.scale);
return this;
>>>>>>>
this.scale.set(transform.scale);
return this; |
<<<<<<<
SuperCamScript.prototype.updateButtonState = function(buttonIndex, down) {
if (buttonIndex === 2 || buttonIndex === 0 && this.shiftKey) {
OrbitCamControlScript.prototype.updateButtonState.call(this, 0, down);
} else if (buttonIndex === 1 || buttonIndex === 0 && this.altKey) {
=======
OrbitNPanControlScript.prototype.updateButtonState = function(buttonIndex, down) {
OrbitCamControlScript.prototype.updateButtonState.call(this, buttonIndex, down);
if (buttonIndex === 1) {
>>>>>>>
OrbitNPanControlScript.prototype.updateButtonState = function(buttonIndex, down) {
if (buttonIndex === 2 || buttonIndex === 0 && this.shiftKey) {
OrbitCamControlScript.prototype.updateButtonState.call(this, 0, down);
} else if (buttonIndex === 1 || buttonIndex === 0 && this.altKey) {
<<<<<<<
// REVIEW: made the console.log conditional
if(this.debug) {
console.log(v.data);
}
=======
>>>>>>> |
<<<<<<<
function Bloom(id) {
BloomPass.call(this);
this.id = id;
=======
/** @class */
function Bloom() {
BloomPass.call(this, arguments);
>>>>>>>
/** @class */
function Bloom(id) {
BloomPass.call(this);
this.id = id; |
<<<<<<<
model.get('errors').add('meta_title', '优化标题不能超过 150 个字符。');
=======
model.get('errors').add('metaTitle', 'Meta Title cannot be longer than 150 characters.');
>>>>>>>
model.get('errors').add('metaTitle', '优化标题不能超过 150 个字符。');
<<<<<<<
model.get('errors').add('meta_description', '优化描述不能超过 200 个字符。');
=======
model.get('errors').add('metaDescription', 'Meta Description cannot be longer than 200 characters.');
>>>>>>>
model.get('errors').add('metaDescription', '优化描述不能超过 200 个字符。'); |
<<<<<<<
/*
* @class Handler for loading project into engine (actually loading mainScene)
* @extends ConfigHandler
* @param {World} world
* @param {Function} getConfig
* @param {Function} updateObject
=======
/*jshint eqeqeq: false, -W041 */
/**
* @class
* @constructor
* @private
>>>>>>>
/*jshint eqeqeq: false, -W041 */
/**
* @class Handler for loading project into engine (actually loading mainScene)
* @private
* @extends ConfigHandler
* @param {World} world
* @param {Function} getConfig
* @param {Function} updateObject |
<<<<<<<
* @param {Object} object
* @param {string[]} methodNames
=======
* @param object
* @param {Array<string>} methodNames
>>>>>>>
* @param {Object} object
* @param {Array<string>} methodNames
<<<<<<<
=======
/**
* Performs a component-wise addition and stores the result in a separate vector. Equivalent of 'return (target = lhs + rhs);'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @param {Vector} [target] Target vector for storage.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.add = function (lhs, rhs, target) {
var ldata = lhs.data || lhs;
var rdata = rhs.data || rhs;
var size = ldata.length;
if (!target) {
target = new Vector(size);
}
for (var i = 0; i < size; i++) {
target.data[i] = ldata[i] + rdata[i];
}
return target;
};
/**
* Performs a component-wise addition and stores the result locally. Equivalent of 'return (this = this + rhs);'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.add = function (rhs) {
return Vector.add(this, rhs, this);
};
/**
* Performs a component-wise subtraction and stores the result in a separate vector. Equivalent of 'return (target = lhs - rhs);'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @param {Vector} [target] Target vector for storage.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.sub = function (lhs, rhs, target) {
var ldata = lhs.data || lhs;
var rdata = rhs.data || rhs;
var size = ldata.length;
if (!target) {
target = new Vector(size);
}
for (var i = 0; i < size; i++) {
target.data[i] = ldata[i] - rdata[i];
}
return target;
};
/**
* Performs a component-wise addition and stores the result locally. Equivalent of 'return (this = this - rhs);'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.sub = function (rhs) {
return Vector.sub(this, rhs, this);
};
/**
* Performs a component-wise multiplication and stores the result in a separate vector. Equivalent of 'return (target = lhs * rhs);'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @param {Vector} [target] Target vector for storage.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.mul = function (lhs, rhs, target) {
var ldata = lhs.data || lhs;
var rdata = rhs.data || rhs;
var size = ldata.length;
if (!target) {
target = new Vector(size);
}
for (var i = 0; i < size; i++) {
target.data[i] = ldata[i] * rdata[i];
}
return target;
};
/**
* Performs a component-wise addition and stores the result locally. Equivalent of 'return (this = this * rhs);'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.mul = function (rhs) {
return Vector.mul(this, rhs, this);
};
/**
* Performs a component-wise division and stores the result in a separate vector. Equivalent of 'return (target = lhs / rhs);'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @param {Vector} [target] Target vector for storage.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.div = function (lhs, rhs, target) {
var ldata = lhs.data || lhs;
var rdata = rhs.data || rhs;
var size = ldata.length;
if (!target) {
target = new Vector(size);
}
for (var i = 0; i < size; i++) {
target.data[i] = ldata[i] / rdata[i];
}
return target;
};
/**
* Performs a component-wise division and stores the result locally. Equivalent of 'return (this = this / rhs);'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.div = function (rhs) {
return Vector.div(this, rhs, this);
};
/**
* Copies component values and stores them in a separate vector. Equivalent of 'return (target = source);'.
* @param {Vector} source Source vector.
* @param {Vector} [target] Target vector.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.copy = function (source, target) {
var size = source.data.length;
if (!target) {
target = new Vector(size);
}
target.data.set(source.data);
return target;
};
/**
* Copies component values and stores them locally. Equivalent of 'return (this = source);'.
* @param {Vector} source Source vector.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.copy = function (source) {
this.data.set(source.data);
return this;
};
/**
* Computes the dot product between two vectors. Equivalent of 'return lhs•rhs;'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars on the left-hand side.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Dot product.
*/
Vector.dot = function (lhs, rhs) {
var ldata = lhs.data || lhs;
var rdata = rhs.data || rhs;
var size = ldata.length;
var sum = 0.0;
for (var i = 0; i < size; i++) {
sum += ldata[i] * rdata[i];
}
return sum;
};
/**
* Computes the dot product between two vectors. Equivalent of 'return this•rhs;'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Dot product.
*/
Vector.prototype.dot = function (rhs) {
return Vector.dot(this, rhs);
};
/**
* Applies a matrix to a vector and stores the result in a separate vector. Equivalent of 'return (target = lhs•rhs);'.
* @param {Matrix} lhs Matrix on the left-hand side.
* @param {Vector} rhs Vector on the right-hand side.
* @param {Vector} [target] Target vector for storage.
* @returns {Vector} A new vector if the target vector is omitted, else the target vector.
*/
Vector.apply = function (lhs, rhs, target) {
var rows = lhs.rows;
var cols = lhs.cols;
var size = rhs.data.length;
if (!target) {
target = new Vector(rows);
}
if (target === rhs) {
return Vector.copy(Vector.apply(lhs, rhs), target);
}
for (var c = 0; c < cols; c++) {
var o = c * rows;
for (var r = 0; r < rows; r++) {
var sum = 0.0;
for (var i = 0; i < size; i++) {
sum += lhs.data[i * lhs.rows + r] * rhs.data[i];
}
target.data[o + r] = sum;
}
}
return target;
};
/**
* Applys a matrix to a vector and stores the result locally. Equivalent of 'return (this = lhs•this);'.
* @param {Matrix} lhs Matrix on the left-hand side.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.apply = function (lhs) {
return Vector.apply(lhs, this, this);
};
/**
* Compares two vectors for approximate equality. Equivalent of 'return (lhs ~ rhs);'.
* @param {Vector} lhs Vector on the left-hand side.
* @param {Vector} rhs Vector on the right-hand side.
* @returns {boolean} True if equal.
*/
Vector.equals = function (lhs, rhs) {
var lhsLength = lhs.data.length;
if (lhsLength !== rhs.data.length) {
return false;
}
for (var i = 0; i < lhsLength; i++) {
// why the backwards check? because otherwise if NaN is present in either lhs or rhs
// then Math.abs(NaN) is NaN which is neither bigger or smaller than EPSILON
// which never satisfies the condition
// NaN is not close to to NaN and we want to preserve that for vectors as well
if (!(Math.abs(lhs.data[i] - rhs.data[i]) <= MathUtils.EPSILON)) {
return false;
}
}
return true;
};
/**
* Compares two vectors for approximate equality. Equivalent of 'return (this ~ rhs);'
* @param {Vector} rhs Vector on the right-hand side.
* @returns {boolean} True if equal.
*/
Vector.prototype.equals = function (rhs) {
return Vector.equals(this, rhs);
};
/**
* Computes the squared distance between two vectors. Equivalent of 'return (rhs - lhs)•(rhs - lhs);'. When comparing the relative
* distances between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root
* operation.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars on the left-hand side.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Squared distance.
*/
Vector.distanceSquared = function (lhs, rhs) {
return Vector.sub(lhs, rhs).lengthSquared();
};
/**
* Computes the squared distance between two vectors. Equivalent of 'return (rhs - this)•(rhs - this);'. When comparing the
* relative distances between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square
* root operation.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Squared distance.
*/
Vector.prototype.distanceSquared = function (rhs) {
return Vector.sub(this, rhs).lengthSquared();
};
/**
* Computes the distance between two vectors. Equivalent of 'return sqrt((rhs - lhs)•(rhs - lhs));'.
* @param {(Vector|Array<number>)} lhs Vector or array of scalars on the left-hand side.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Distance.
*/
Vector.distance = function (lhs, rhs) {
return Vector.sub(lhs, rhs).length();
};
/**
* Computes the distance between two vectors. Equivalent of 'return sqrt((rhs - this)•(rhs - this));'.
* @param {(Vector|Array<number>)} rhs Vector or array of scalars on the right-hand side.
* @returns {number} Distance.
*/
Vector.prototype.distance = function (rhs) {
return Vector.sub(this, rhs).length();
};
/**
* Computes the squared length of the vector. Equivalent of 'return this•this;'.
* @returns {number} Square length.
*/
Vector.prototype.lengthSquared = function () {
return Vector.dot(this, this);
};
/**
* Computes the length of the vector. Equivalent of 'return sqrt(this•this);'.
* @returns {number} Length.
*/
Vector.prototype.length = function () {
return Math.sqrt(Vector.dot(this, this));
};
/**
* Scales the vector
* @param {number} factor
* @returns {Vector} this for chaining
*/
Vector.prototype.scale = function(factor) {
for (var i = this.data.length - 1; i >= 0; i--) {
this.data[i] *= factor;
}
return this;
};
/**
* Inverts all component values of the vector. Equivalent of 'return (this = 0.0 - this);'.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.invert = function () {
for (var i = 0; i < this.data.length; i++) {
this.data[i] = 0.0 - this.data[i];
}
return this;
};
/**
* Normalizes the vector to unit length. Equivalent of 'return (this = this/sqrt(this•this));'.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.normalize = function () {
var l = this.length();
var dataLength = this.data.length;
if (l < MathUtils.EPSILON) {
for (var i = 0; i < dataLength; i++) {
this.data[i] = 0;
}
} else {
l = 1.0 / l;
for (var i = 0; i < dataLength; i++) {
this.data[i] *= l;
}
}
return this;
};
/**
* Clones the vector. Equivalent of 'return (clone = this)'.
* @returns {Vector} Clone of self.
*/
Vector.prototype.clone = function () {
return Vector.copy(this);
};
/**
* Sets the components of the vector.
* @param {(Vector|Array<number>)} arguments Component values.
* @returns {Vector} Self for chaining.
*/
Vector.prototype.set = function () {
if (arguments.length === 1 && typeof arguments[0] === 'object') {
if (arguments[0] instanceof Vector) {
this.copy(arguments[0]);
} else {
for (var i = 0; i < arguments[0].length; i++) {
this.data[i] = arguments[0][i];
}
}
} else {
for (var i = 0; i < arguments.length; i++) {
this.data[i] = arguments[i];
}
}
return this;
};
/**
* Converts the vector to a string.
* @returns {string} String of component values.
*/
Vector.prototype.toString = function () {
var string = '';
string += '[';
for (var i = 0; i < this.data.length; i++) {
string += this.data[i];
string += i !== this.data.length - 1 ? ', ' : '';
}
string += ']';
return string;
};
>>>>>>> |
<<<<<<<
'goo/renderer/RendererUtils',
=======
'goo/renderer/RendererUtils',
'goo/math/MathUtils',
>>>>>>>
'goo/math/MathUtils',
<<<<<<<
RendererUtils,
=======
RendererUtils,
MathUtils,
>>>>>>>
MathUtils, |
<<<<<<<
'goo/util/ArrayUtil',
'goo/util/rsvp'
], function(
=======
'goo/util/ArrayUtil'
],
/** @lends */
function(
>>>>>>>
'goo/util/ArrayUtil',
'goo/util/rsvp'
],
/** @lends */
function(
<<<<<<<
/*
* @class For handling loading of transform component
* @constructor
* @param {World} world The goo world
* @param {function} getConfig The config loader function. See {@see DynamicLoader._loadRef}.
* @param {function} updateObject The handler function. See {@see DynamicLoader.update}.
* @extends ComponentHandler
*/
=======
/*jshint eqeqeq: false, -W041 */
/**
* @class
*/
>>>>>>>
/*
* @class For handling loading of transform component
* @constructor
* @param {World} world The goo world
* @param {function} getConfig The config loader function. See {@see DynamicLoader._loadRef}.
* @param {function} updateObject The handler function. See {@see DynamicLoader.update}.
* @extends ComponentHandler
*/ |
<<<<<<<
'goo/math/Vector3',
'goo/math/Ray',
=======
'goo/math/Vector3',
'goo/math/Matrix4x4',
>>>>>>>
'goo/math/Vector3',
'goo/math/Ray',
<<<<<<<
Vector3,
Ray,
=======
Vector3,
Matrix4x4,
>>>>>>>
Vector3,
Ray,
<<<<<<<
this.compileRenderables();
=======
// Build geometry
this._quadMesh = new Quad(2, 2);
this._arrowMesh = this._buildArrowMesh();
this._buildArrow(0);
this._buildArrow(1);
this._buildArrow(2);
this.realTranslation = new Vector3();
this._snap = false;
>>>>>>>
this.realTranslation = new Vector3();
this._snap = false;
this.compileRenderables();
<<<<<<<
function buildArrowMesh() {
=======
TranslationGizmo.prototype._buildArrowMesh = function () {
>>>>>>>
function buildArrowMesh() { |
<<<<<<<
module.exports = LookAtAction;
=======
LookAtAction.prototype.enter = function (fsm) {
if (!this.everyFrame) {
this.doLookAt(fsm);
}
};
LookAtAction.prototype.update = function (fsm) {
if (this.everyFrame) {
this.doLookAt(fsm);
}
};
return LookAtAction;
});
>>>>>>>
LookAtAction.prototype.enter = function (fsm) {
if (!this.everyFrame) {
this.doLookAt(fsm);
}
};
LookAtAction.prototype.update = function (fsm) {
if (this.everyFrame) {
this.doLookAt(fsm);
}
};
module.exports = LookAtAction; |
<<<<<<<
goog.provide('ol.renderer.canvas.Renderer');
goog.provide('ol.renderer.canvas.isSupported');
=======
goog.provide('ol.renderer.canvas.SUPPORTED');
>>>>>>>
goog.provide('ol.renderer.canvas.Renderer');
goog.provide('ol.renderer.canvas.SUPPORTED');
<<<<<<<
ol.renderer.canvas.isSupported = ol.canvas.isSupported;
/**
* @constructor
* @param {HTMLCanvasElement} canvas Target canvas.
* @param {goog.vec.Mat4.Number} transform Transform.
* @param {ol.Pixel=} opt_offset Pixel offset for top-left corner. This is
* provided as an optional argument as a convenience in cases where the
* transform applies to a separate canvas.
*/
ol.renderer.canvas.Renderer = function(canvas, transform, opt_offset) {
var context = /** @type {CanvasRenderingContext2D} */
(canvas.getContext('2d')),
dx = goog.isDef(opt_offset) ? opt_offset.x : 0,
dy = goog.isDef(opt_offset) ? opt_offset.y : 0;
/**
* @type {goog.vec.Mat4.Number}
* @private
*/
this.transform_ = transform;
context.setTransform(
goog.vec.Mat4.getElement(transform, 0, 0),
goog.vec.Mat4.getElement(transform, 1, 0),
goog.vec.Mat4.getElement(transform, 0, 1),
goog.vec.Mat4.getElement(transform, 1, 1),
goog.vec.Mat4.getElement(transform, 0, 3) + dx,
goog.vec.Mat4.getElement(transform, 1, 3) + dy);
var vec = [1, 0, 0];
goog.vec.Mat4.multVec3NoTranslate(transform, vec, vec);
/**
* @type {number}
* @private
*/
this.inverseScale_ = 1 / Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
/**
* @type {CanvasRenderingContext2D}
* @private
*/
this.context_ = context;
};
/**
* @param {ol.geom.GeometryType} type Geometry type.
* @param {Array.<ol.Feature>} features Array of features.
* @param {ol.style.SymbolizerLiteral} symbolizer Symbolizer.
*/
ol.renderer.canvas.Renderer.prototype.renderFeaturesByGeometryType =
function(type, features, symbolizer) {
switch (type) {
case ol.geom.GeometryType.POINT:
goog.asserts.assert(symbolizer instanceof ol.style.PointLiteral);
this.renderPointFeatures_(
features, /** @type {ol.style.PointLiteral} */ (symbolizer));
break;
case ol.geom.GeometryType.LINESTRING:
goog.asserts.assert(symbolizer instanceof ol.style.LineLiteral);
this.renderLineStringFeatures_(
features, /** @type {ol.style.LineLiteral} */ (symbolizer));
break;
case ol.geom.GeometryType.POLYGON:
goog.asserts.assert(symbolizer instanceof ol.style.PolygonLiteral);
this.renderPolygonFeatures_(
features, /** @type {ol.style.PolygonLiteral} */ (symbolizer));
break;
default:
throw new Error('Rendering not implemented for geometry type: ' + type);
}
};
/**
* @param {Array.<ol.Feature>} features Array of line features.
* @param {ol.style.LineLiteral} symbolizer Line symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderLineStringFeatures_ =
function(features, symbolizer) {
var context = this.context_,
i, ii, line, coords, dim, j, jj, x, y;
context.globalAlpha = symbolizer.opacity;
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
context.beginPath();
for (i = 0, ii = features.length; i < ii; ++i) {
line = features[i].getGeometry();
dim = line.dimension;
coords = line.coordinates;
for (j = 0, jj = coords.length; j < jj; j += dim) {
x = coords[j];
y = coords[j + 1];
if (j === 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);
}
}
}
context.stroke();
};
/**
* @param {Array.<ol.Feature>} features Array of point features.
* @param {ol.style.PointLiteral} symbolizer Point symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderPointFeatures_ =
function(features, symbolizer) {
var context = this.context_,
canvas, i, ii, coords, vec;
if (symbolizer instanceof ol.style.ShapeLiteral) {
canvas = ol.renderer.canvas.Renderer.renderShape(symbolizer);
} else {
throw new Error('Unsupported symbolizer: ' + symbolizer);
}
var mid = canvas.width / 2;
context.save();
context.setTransform(1, 0, 0, 1, -mid, -mid);
context.globalAlpha = 1;
for (i = 0, ii = features.length; i < ii; ++i) {
coords = features[i].getGeometry().coordinates;
vec = goog.vec.Mat4.multVec3(
this.transform_, [coords[0], coords[1], 0], []);
context.drawImage(canvas, vec[0], vec[1]);
}
context.restore();
};
/**
* @param {Array.<ol.Feature>} features Array of polygon features.
* @param {ol.style.PolygonLiteral} symbolizer Polygon symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderPolygonFeatures_ =
function(features, symbolizer) {
var context = this.context_,
strokeStyle = symbolizer.strokeStyle,
fillStyle = symbolizer.fillStyle,
i, ii, poly, rings, numRings, coords, dim, j, jj, x, y;
context.globalAlpha = symbolizer.opacity;
if (strokeStyle) {
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
}
if (fillStyle) {
context.fillStyle = fillStyle;
}
/**
* Four scenarios covered here:
* 1) stroke only, no holes - only need to have a single path
* 2) fill only, no holes - only need to have a single path
* 3) fill and stroke, no holes
* 4) holes - render polygon to sketch canvas first
*/
context.beginPath();
for (i = 0, ii = features.length; i < ii; ++i) {
poly = features[i].getGeometry();
dim = poly.dimension;
rings = poly.rings;
numRings = rings.length;
if (numRings > 1) {
// scenario 4
// TODO: use sketch canvas to render outer and punch holes for inner rings
throw new Error('Rendering holes not implemented');
} else {
coords = rings[0].coordinates;
for (j = 0, jj = coords.length; j < jj; j += dim) {
x = coords[j];
y = coords[j + 1];
if (j === 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);
}
}
if (fillStyle && strokeStyle) {
// scenario 3 - fill and stroke each time
context.fill();
context.stroke();
if (i < ii - 1) {
context.beginPath();
}
}
}
}
if (!(fillStyle && strokeStyle)) {
if (fillStyle) {
// scenario 2 - fill all at once
context.fill();
} else {
// scenario 1 - stroke all at once
context.stroke();
}
}
};
/**
* @param {ol.style.ShapeLiteral} circle Shape symbolizer.
* @return {!HTMLCanvasElement} Canvas element.
* @private
*/
ol.renderer.canvas.Renderer.renderCircle_ = function(circle) {
var size = circle.size + (2 * circle.strokeWidth) + 1,
mid = size / 2,
canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS)),
context = /** @type {CanvasRenderingContext2D} */
(canvas.getContext('2d')),
fillStyle = circle.fillStyle,
strokeStyle = circle.strokeStyle,
twoPi = Math.PI * 2;
canvas.height = size;
canvas.width = size;
context.globalAlpha = circle.opacity;
if (fillStyle) {
context.fillStyle = circle.fillStyle;
}
if (strokeStyle) {
context.lineWidth = circle.strokeWidth;
context.strokeStyle = circle.strokeStyle;
}
context.beginPath();
context.arc(mid, mid, circle.size / 2, 0, twoPi, true);
if (fillStyle) {
context.fill();
}
if (strokeStyle) {
context.stroke();
}
return canvas;
};
/**
* @param {ol.style.ShapeLiteral} shape Shape symbolizer.
* @return {!HTMLCanvasElement} Canvas element.
*/
ol.renderer.canvas.Renderer.renderShape = function(shape) {
var canvas;
if (shape.type === ol.style.ShapeType.CIRCLE) {
canvas = ol.renderer.canvas.Renderer.renderCircle_(shape);
} else {
throw new Error('Unsupported shape type: ' + shape);
}
return canvas;
};
=======
ol.renderer.canvas.SUPPORTED = ol.canvas.SUPPORTED;
>>>>>>>
ol.renderer.canvas.SUPPORTED = ol.canvas.SUPPORTED;
/**
* @constructor
* @param {HTMLCanvasElement} canvas Target canvas.
* @param {goog.vec.Mat4.Number} transform Transform.
* @param {ol.Pixel=} opt_offset Pixel offset for top-left corner. This is
* provided as an optional argument as a convenience in cases where the
* transform applies to a separate canvas.
*/
ol.renderer.canvas.Renderer = function(canvas, transform, opt_offset) {
var context = /** @type {CanvasRenderingContext2D} */
(canvas.getContext('2d')),
dx = goog.isDef(opt_offset) ? opt_offset.x : 0,
dy = goog.isDef(opt_offset) ? opt_offset.y : 0;
/**
* @type {goog.vec.Mat4.Number}
* @private
*/
this.transform_ = transform;
context.setTransform(
goog.vec.Mat4.getElement(transform, 0, 0),
goog.vec.Mat4.getElement(transform, 1, 0),
goog.vec.Mat4.getElement(transform, 0, 1),
goog.vec.Mat4.getElement(transform, 1, 1),
goog.vec.Mat4.getElement(transform, 0, 3) + dx,
goog.vec.Mat4.getElement(transform, 1, 3) + dy);
var vec = [1, 0, 0];
goog.vec.Mat4.multVec3NoTranslate(transform, vec, vec);
/**
* @type {number}
* @private
*/
this.inverseScale_ = 1 / Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
/**
* @type {CanvasRenderingContext2D}
* @private
*/
this.context_ = context;
};
/**
* @param {ol.geom.GeometryType} type Geometry type.
* @param {Array.<ol.Feature>} features Array of features.
* @param {ol.style.SymbolizerLiteral} symbolizer Symbolizer.
*/
ol.renderer.canvas.Renderer.prototype.renderFeaturesByGeometryType =
function(type, features, symbolizer) {
switch (type) {
case ol.geom.GeometryType.POINT:
goog.asserts.assert(symbolizer instanceof ol.style.PointLiteral);
this.renderPointFeatures_(
features, /** @type {ol.style.PointLiteral} */ (symbolizer));
break;
case ol.geom.GeometryType.LINESTRING:
goog.asserts.assert(symbolizer instanceof ol.style.LineLiteral);
this.renderLineStringFeatures_(
features, /** @type {ol.style.LineLiteral} */ (symbolizer));
break;
case ol.geom.GeometryType.POLYGON:
goog.asserts.assert(symbolizer instanceof ol.style.PolygonLiteral);
this.renderPolygonFeatures_(
features, /** @type {ol.style.PolygonLiteral} */ (symbolizer));
break;
default:
throw new Error('Rendering not implemented for geometry type: ' + type);
}
};
/**
* @param {Array.<ol.Feature>} features Array of line features.
* @param {ol.style.LineLiteral} symbolizer Line symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderLineStringFeatures_ =
function(features, symbolizer) {
var context = this.context_,
i, ii, line, coords, dim, j, jj, x, y;
context.globalAlpha = symbolizer.opacity;
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
context.beginPath();
for (i = 0, ii = features.length; i < ii; ++i) {
line = features[i].getGeometry();
dim = line.dimension;
coords = line.coordinates;
for (j = 0, jj = coords.length; j < jj; j += dim) {
x = coords[j];
y = coords[j + 1];
if (j === 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);
}
}
}
context.stroke();
};
/**
* @param {Array.<ol.Feature>} features Array of point features.
* @param {ol.style.PointLiteral} symbolizer Point symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderPointFeatures_ =
function(features, symbolizer) {
var context = this.context_,
canvas, i, ii, coords, vec;
if (symbolizer instanceof ol.style.ShapeLiteral) {
canvas = ol.renderer.canvas.Renderer.renderShape(symbolizer);
} else {
throw new Error('Unsupported symbolizer: ' + symbolizer);
}
var mid = canvas.width / 2;
context.save();
context.setTransform(1, 0, 0, 1, -mid, -mid);
context.globalAlpha = 1;
for (i = 0, ii = features.length; i < ii; ++i) {
coords = features[i].getGeometry().coordinates;
vec = goog.vec.Mat4.multVec3(
this.transform_, [coords[0], coords[1], 0], []);
context.drawImage(canvas, vec[0], vec[1]);
}
context.restore();
};
/**
* @param {Array.<ol.Feature>} features Array of polygon features.
* @param {ol.style.PolygonLiteral} symbolizer Polygon symbolizer.
* @private
*/
ol.renderer.canvas.Renderer.prototype.renderPolygonFeatures_ =
function(features, symbolizer) {
var context = this.context_,
strokeStyle = symbolizer.strokeStyle,
fillStyle = symbolizer.fillStyle,
i, ii, poly, rings, numRings, coords, dim, j, jj, x, y;
context.globalAlpha = symbolizer.opacity;
if (strokeStyle) {
context.strokeStyle = symbolizer.strokeStyle;
context.lineWidth = symbolizer.strokeWidth * this.inverseScale_;
}
if (fillStyle) {
context.fillStyle = fillStyle;
}
/**
* Four scenarios covered here:
* 1) stroke only, no holes - only need to have a single path
* 2) fill only, no holes - only need to have a single path
* 3) fill and stroke, no holes
* 4) holes - render polygon to sketch canvas first
*/
context.beginPath();
for (i = 0, ii = features.length; i < ii; ++i) {
poly = features[i].getGeometry();
dim = poly.dimension;
rings = poly.rings;
numRings = rings.length;
if (numRings > 1) {
// scenario 4
// TODO: use sketch canvas to render outer and punch holes for inner rings
throw new Error('Rendering holes not implemented');
} else {
coords = rings[0].coordinates;
for (j = 0, jj = coords.length; j < jj; j += dim) {
x = coords[j];
y = coords[j + 1];
if (j === 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);
}
}
if (fillStyle && strokeStyle) {
// scenario 3 - fill and stroke each time
context.fill();
context.stroke();
if (i < ii - 1) {
context.beginPath();
}
}
}
}
if (!(fillStyle && strokeStyle)) {
if (fillStyle) {
// scenario 2 - fill all at once
context.fill();
} else {
// scenario 1 - stroke all at once
context.stroke();
}
}
};
/**
* @param {ol.style.ShapeLiteral} circle Shape symbolizer.
* @return {!HTMLCanvasElement} Canvas element.
* @private
*/
ol.renderer.canvas.Renderer.renderCircle_ = function(circle) {
var size = circle.size + (2 * circle.strokeWidth) + 1,
mid = size / 2,
canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS)),
context = /** @type {CanvasRenderingContext2D} */
(canvas.getContext('2d')),
fillStyle = circle.fillStyle,
strokeStyle = circle.strokeStyle,
twoPi = Math.PI * 2;
canvas.height = size;
canvas.width = size;
context.globalAlpha = circle.opacity;
if (fillStyle) {
context.fillStyle = circle.fillStyle;
}
if (strokeStyle) {
context.lineWidth = circle.strokeWidth;
context.strokeStyle = circle.strokeStyle;
}
context.beginPath();
context.arc(mid, mid, circle.size / 2, 0, twoPi, true);
if (fillStyle) {
context.fill();
}
if (strokeStyle) {
context.stroke();
}
return canvas;
};
/**
* @param {ol.style.ShapeLiteral} shape Shape symbolizer.
* @return {!HTMLCanvasElement} Canvas element.
*/
ol.renderer.canvas.Renderer.renderShape = function(shape) {
var canvas;
if (shape.type === ol.style.ShapeType.CIRCLE) {
canvas = ol.renderer.canvas.Renderer.renderCircle_(shape);
} else {
throw new Error('Unsupported shape type: ' + shape);
}
return canvas;
}; |
<<<<<<<
* @param {ol.source.TileWMSOptions} options Tile WMS options.
=======
* @implements {ol.source.FeatureInfoSource}
* @param {olx.source.TileWMSOptions} options Tile WMS options.
>>>>>>>
* @param {olx.source.TileWMSOptions} options Tile WMS options.
<<<<<<<
=======
/**
* @private
* @type {olx.source.WMSGetFeatureInfoOptions}
*/
this.getFeatureInfoOptions_ = goog.isDef(options.getFeatureInfoOptions) ?
options.getFeatureInfoOptions :
/** @type {olx.source.WMSGetFeatureInfoOptions} */ ({});
>>>>>>> |
<<<<<<<
var geom = parser.createGeometry({geometry: obj.geometry});
parser.srsName = 'foo';
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = parser.createGeometry({geometry: obj.geometry});
parser.srsName = 'foo';
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
var geom = parser.createGeometry({geometry: obj.geometry});
parser.srsName = 'foo';
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = parser.createGeometry({geometry: obj.geometry});
parser.srsName = 'foo';
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj, {srsName: 'foo'});
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj, {srsName: 'foo'}); |
<<<<<<<
};
/**
* @param {number|undefined} opt_arg Get or set the current zoom level.
* @returns {ol.Map|number|undefined} current zoom level on get or the map.
*/
ol.Map.prototype.zoom = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setZoom(opt_arg);
} else {
return this.getZoom();
}
};
/**
* @param {ol.Projection|string|undefined} opt_arg Get or set the map projection.
* @returns {ol.Map|number|undefined} the current zoom level, or the map on set.
*/
ol.Map.prototype.projection = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setZoom(opt_arg);
} else {
return this.getZoom();
}
};
/**
* @param {number|undefined} opt_arg Get or set the number of zoom levels.
* @returns {ol.Map|number|undefined} the number of zoom levels, or the map on set.
*/
ol.Map.prototype.numZoomLevels = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setNumZoomLevels(opt_arg);
} else {
return this.getNumZoomLevels();
}
=======
};
/**
* @param {ol.ProjectionLike=} opt_arg
* @returns {ol.Map|ol.Loc|undefined}
*/
ol.Map.prototype.projection = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setProjection(ol.projection(opt_arg));
} else {
return this.getProjection();
}
};
/**
* @param {ol.ProjectionLike=} opt_arg
* @returns {ol.Map|ol.Loc|undefined}
*/
ol.Map.prototype.userProjection = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setUserProjection(ol.projection(opt_arg));
} else {
return this.getUserProjection();
}
>>>>>>>
};
/**
* @param {ol.Projection|string|undefined} opt_arg Get or set the map projection.
* @returns {ol.Map|number|undefined} the current zoom level, or the map on set.
*/
ol.Map.prototype.projection = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setProjection(ol.projection(opt_arg));
} else {
return this.getProjection();
}
};
/**
* @param {ol.ProjectionLike=} opt_arg
* @returns {ol.Map|ol.Loc|undefined}
*/
ol.Map.prototype.userProjection = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setUserProjection(ol.projection(opt_arg));
} else {
return this.getUserProjection();
}
};
/**
* @param {number|undefined} opt_arg Get or set the current zoom level.
* @returns {ol.Map|number|undefined} current zoom level on get or the map.
*/
ol.Map.prototype.zoom = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setZoom(opt_arg);
} else {
return this.getZoom();
}
};
/**
* @param {number|undefined} opt_arg Get or set the number of zoom levels.
* @returns {ol.Map|number|undefined} the number of zoom levels, or the map on set.
*/
ol.Map.prototype.numZoomLevels = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setNumZoomLevels(opt_arg);
} else {
return this.getNumZoomLevels();
} |
<<<<<<<
if (goog.isDef(config.fillStyle)) {
goog.asserts.assertString(config.fillStyle, 'fillStyle must be a string');
}
/** @type {string|undefined} */
=======
goog.asserts.assertString(config.fillStyle, 'fillStyle must be a string');
/** @type {string} */
>>>>>>>
/** @type {string|undefined} */
<<<<<<<
/** @type {number|undefined} */
=======
goog.asserts.assertNumber(config.strokeWidth, 'strokeWidth must be a number');
/** @type {number} */
>>>>>>>
/** @type {number|undefined} */ |
<<<<<<<
goog.require('ol.vec.Mat4');
=======
goog.require('ol.source.Image');
>>>>>>>
goog.require('ol.source.Image');
goog.require('ol.vec.Mat4'); |
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
parser.applyWriteOptions(obj);
var geom = parser.createGeometry_({geometry: obj.geometry});
>>>>>>>
parser.applyWriteOptions(obj);
var geom = parser.createGeometry({geometry: obj.geometry});
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj);
<<<<<<<
var geom = p.createGeometry({geometry: obj.geometry});
=======
var geom = p.createGeometry_({geometry: obj.geometry});
p.applyWriteOptions(obj);
>>>>>>>
var geom = p.createGeometry({geometry: obj.geometry});
p.applyWriteOptions(obj);
<<<<<<<
parser.srsName = 'foo';
var geom = parser.createGeometry({geometry: obj.geometry});
=======
var geom = parser.createGeometry_({geometry: obj.geometry});
parser.applyWriteOptions(obj);
>>>>>>>
var geom = parser.createGeometry({geometry: obj.geometry});
parser.applyWriteOptions(obj); |
<<<<<<<
( metaRequired == metaPressed ) &&
( altRequired == altPressed ) &&
( ctrlRequired == ctrlPressed ) &&
( shiftRequired == shiftPressed )
=======
( altRequired === altPressed ) &&
( ctrlRequired === ctrlPressed ) &&
( shiftRequired === shiftPressed )
>>>>>>>
( metaRequired === metaPressed ) &&
( altRequired === altPressed ) &&
( ctrlRequired === ctrlPressed ) &&
( shiftRequired === shiftPressed ) |
<<<<<<<
};
export const SHOW_SUMMARY_ACCOUNT_DETAILS = false;
export const SHOW_TOTAL_ASSETS = false;
export const IS_XHT = true;
export const FIT_SCREEN_HEIGHT = ['trade'];
=======
};
export const SIMPLE_FORMAT_MIN = '0.1';
>>>>>>>
};
export const SHOW_SUMMARY_ACCOUNT_DETAILS = false;
export const SHOW_TOTAL_ASSETS = false;
export const IS_XHT = true;
export const FIT_SCREEN_HEIGHT = ['trade'];
export const SIMPLE_FORMAT_MIN = '0.1'; |
<<<<<<<
uuid: DS.attr('string'),
name: DS.attr('string'),
slug: DS.attr('string'),
email: DS.attr('string'),
image: DS.attr('string'),
cover: DS.attr('string'),
bio: DS.attr('string'),
website: DS.attr('string'),
location: DS.attr('string'),
accessibility: DS.attr('string'),
status: DS.attr('string'),
language: DS.attr('string', {defaultValue: 'zh_CN'}),
meta_title: DS.attr('string'),
meta_description: DS.attr('string'),
last_login: DS.attr('moment-date'),
created_at: DS.attr('moment-date'),
created_by: DS.attr('number'),
updated_at: DS.attr('moment-date'),
updated_by: DS.attr('number'),
roles: DS.hasMany('role', {
=======
uuid: attr('string'),
name: attr('string'),
slug: attr('string'),
email: attr('string'),
image: attr('string'),
cover: attr('string'),
bio: attr('string'),
website: attr('string'),
location: attr('string'),
accessibility: attr('string'),
status: attr('string'),
language: attr('string', {defaultValue: 'en_US'}),
meta_title: attr('string'),
meta_description: attr('string'),
last_login: attr('moment-date'),
created_at: attr('moment-date'),
created_by: attr('number'),
updated_at: attr('moment-date'),
updated_by: attr('number'),
roles: hasMany('role', {
>>>>>>>
uuid: attr('string'),
name: attr('string'),
slug: attr('string'),
email: attr('string'),
image: attr('string'),
cover: attr('string'),
bio: attr('string'),
website: attr('string'),
location: attr('string'),
accessibility: attr('string'),
status: attr('string'),
language: attr('string', {defaultValue: 'zh_CN'}),
meta_title: attr('string'),
meta_description: attr('string'),
last_login: attr('moment-date'),
created_at: attr('moment-date'),
created_by: attr('number'),
updated_at: attr('moment-date'),
updated_by: attr('number'),
roles: hasMany('role', {
<<<<<<<
},
passwordValidationErrors: Ember.computed('password', 'newPassword', 'ne2Password', function () {
var validationErrors = [];
if (!validator.equals(this.get('newPassword'), this.get('ne2Password'))) {
validationErrors.push({message: '两次输入的新密码不匹配。'});
}
if (!validator.isLength(this.get('newPassword'), 8)) {
validationErrors.push({message: '密码太短。至少输入8个字符。'});
}
return validationErrors;
}),
isPasswordValid: Ember.computed.empty('passwordValidationErrors.[]'),
active: Ember.computed('status', function () {
return ['active', 'warn-1', 'warn-2', 'warn-3', 'warn-4', 'locked'].indexOf(this.get('status')) > -1;
}),
invited: Ember.computed('status', function () {
return ['invited', 'invited-pending'].indexOf(this.get('status')) > -1;
}),
pending: Ember.computed.equal('status', 'invited-pending').property('status')
=======
}
>>>>>>>
} |
<<<<<<<
if ((this.dataset.x % 2 === 0 || this.dataset.y % 2 === 0) && (previewdiv.dataset.name === "straight-rail" || previewdiv.dataset.name === "train-stop")) {
var x = this.dataset.x;
var y = this.dataset.y;
if (x % 2 === 0) {
=======
if ((tile.dataset.x % 2 == 0 || tile.dataset.y % 2 == 0) && (previewdiv.dataset.name == "straight-rail" || previewdiv.dataset.name == "train-stop")) {
var x = tile.dataset.x;
var y = tile.dataset.y;
if (x % 2 == 0) {
>>>>>>>
if ((tile.dataset.x % 2 === 0 || tile.dataset.y % 2 === 0) && (previewdiv.dataset.name === "straight-rail" || previewdiv.dataset.name === "train-stop")) {
var x = tile.dataset.x;
var y = tile.dataset.y;
if (x % 2 === 0) {
<<<<<<<
if (event.buttons === 1) { // Left mouse button is pressed
tileClick.call(this);
} else if (event.buttons === 2) {
tileContextMenu.call(this);
=======
if (event.buttons != 0) { // any button is pressed
tileClick(event, this);
>>>>>>>
if (event.buttons !== 0) { // any button is pressed
tileClick(event, this); |
<<<<<<<
var img = document.createElement("img");
=======
var span = document.createElement("span");
span.setAttribute("class", "preview__image-helper");
div.appendChild(span);
img = document.createElement("img");
>>>>>>>
var span = document.createElement("span");
span.setAttribute("class", "preview__image-helper");
div.appendChild(span);
var img = document.createElement("img"); |
<<<<<<<
angular.forEach(['formatDay', 'formatDayHeader', 'formatDayTitle', 'formatWeekTitle', 'formatMonthTitle', 'formatWeekViewDayHeader', 'formatHourColumn',
'showEventDetail', 'startingDayMonth', 'startingDayWeek', 'eventSource', 'queryMode'], function (key, index) {
self[key] = angular.isDefined($attrs[key]) ? (index < 7 ? $interpolate($attrs[key])($scope.$parent) : $scope.$parent.$eval($attrs[key])) : calendarConfig[key];
=======
angular.forEach(['formatDay', 'formatDayHeader', 'formatDayTitle', 'formatWeekTitle', 'formatMonthTitle',
'showEventDetail', 'startingDayMonth', 'startingDayWeek', 'eventSource', 'queryMode', 'step'], function (key, index) {
self[key] = angular.isDefined($attrs[key]) ? (index < 5 ? $interpolate($attrs[key])($scope.$parent) : $scope.$parent.$eval($attrs[key])) : calendarConfig[key];
>>>>>>>
angular.forEach(['formatDay', 'formatDayHeader', 'formatDayTitle', 'formatWeekTitle', 'formatMonthTitle', 'formatWeekViewDayHeader', 'formatHourColumn',
'showEventDetail', 'startingDayMonth', 'startingDayWeek', 'eventSource', 'queryMode', 'step'], function (key, index) {
self[key] = angular.isDefined($attrs[key]) ? (index < 7 ? $interpolate($attrs[key])($scope.$parent) : $scope.$parent.$eval($attrs[key])) : calendarConfig[key]; |
<<<<<<<
mainLoop();
export {
renderer,
stage
};
=======
module.exports = App
>>>>>>>
module.exports = App
export {
renderer,
stage
}; |
<<<<<<<
=======
console.log('error getting oauth re-authenticate', error)
>>>>>>>
console.log('error getting oauth re-authenticate', error) |
<<<<<<<
=======
resizeBody.disableResize();
resizeDivFrame.disableResize();
>>>>>>>
resizeBody.disableResize();
resizeDivFrame.disableResize(); |
<<<<<<<
import { polyfillWindow, polyunfillWindow } from './spec-helpers'
import { asyncStorage } from './storage'
=======
import { memStorage } from './storage'
import { sessionKeys } from '../test-keys/session-keys'
>>>>>>>
import { polyfillWindow, polyunfillWindow } from './spec-helpers'
import { asyncStorage } from './storage'
import { sessionKeys } from '../test-keys/session-keys'
<<<<<<<
beforeEach(() => {
nock.disableNetConnect()
})
afterEach(() => {
nock.cleanAll()
nock.enableNetConnect()
})
it('returns an anonymous auth response when no recognized auth scheme is present', async () => {
expect.assertions(2)
=======
it('returns an anonymous auth response when no recognized auth scheme is present', () => {
>>>>>>>
beforeEach(() => {
nock.disableNetConnect()
})
afterEach(() => {
nock.cleanAll()
nock.enableNetConnect()
})
it('returns an anonymous auth response when no recognized auth scheme is present', async () => {
expect.assertions(2)
<<<<<<<
it('strips the hash fragment from the current URL when proiding the default redirect URL', async () => {
expect.assertions(6)
=======
it('strips the hash fragment from the current URL when providing the default redirect URL', () => {
>>>>>>>
it('strips the hash fragment from the current URL when providing the default redirect URL', async () => {
expect.assertions(6)
<<<<<<<
const redirectFn = await login('https://localhost')
await redirectFn()
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const callbackUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + 60 * 60, // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href =
`${callbackUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
const session = await currentSession()
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
expect(await getStoredSession()).toEqual(session)
expect(window.location.hash).toBe('')
=======
return login('https://localhost')
.then(() => {
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const redirectUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + (60 * 60), // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href = `${redirectUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
})
.then(currentSession)
.then(({ session }) => {
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
verifySerializedKey(session.sessionKey)
expect(getSession(window.localStorage)).toEqual(session)
expect(window.location.hash).toBe('')
})
>>>>>>>
const redirectFn = await login('https://localhost')
await redirectFn()
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const callbackUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + 60 * 60, // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href =
`${callbackUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
const session = await currentSession()
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
verifySerializedKey(session.sessionKey)
expect(await getStoredSession()).toEqual(session)
expect(window.location.hash).toBe('')
<<<<<<<
const redirectFn = await login('https://localhost')
await redirectFn()
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const callbackUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + 60 * 60, // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href =
`${callbackUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
const session = await currentSession()
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
expect(window.location.hash).toBe('')
const storedSession = await getStoredSession()
expect(storedSession).toEqual(session)
await logout()
expect(await getStoredSession()).toBeNull()
=======
return login('https://localhost')
.then(() => {
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const redirectUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + (60 * 60), // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href = `${redirectUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
})
.then(currentSession)
.then(({ session }) => {
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
verifySerializedKey(session.sessionKey)
expect(window.location.hash).toBe('')
expect(getSession(window.localStorage)).toEqual(session)
})
.then(() => logout())
.then(() => {
expect(getSession(window.localStorage)).toBeNull()
})
>>>>>>>
const redirectFn = await login('https://localhost')
await redirectFn()
// generate the auth response
const location = new window.URL(window.location.href)
const state = location.searchParams.get('state')
const callbackUri = location.searchParams.get('redirect_uri')
const nonce = location.searchParams.get('nonce')
const accessToken = 'example_access_token'
const { alg } = jwks.keys[0]
const idToken = jwt.sign(
{
iss: oidcConfiguration.issuer,
aud: oidcRegistration.client_id,
exp: Math.floor(Date.now() / 1000) + 60 * 60, // one hour
sub: 'https://person.me/#me',
nonce
},
pem,
{ algorithm: alg }
)
expectedIdToken = idToken
expectedAccessToken = accessToken
window.location.href =
`${callbackUri}#` +
`access_token=${accessToken}&` +
`token_type=Bearer&` +
`id_token=${idToken}&` +
`state=${state}`
const session = await currentSession()
expect(session.webId).toBe('https://person.me/#me')
expect(session.accessToken).toBe(expectedAccessToken)
expect(session.idToken).toBe(expectedIdToken)
verifySerializedKey(session.sessionKey)
expect(window.location.hash).toBe('')
const storedSession = await getStoredSession()
expect(storedSession).toEqual(session)
await logout()
expect(await getStoredSession()).toBeNull()
<<<<<<<
it('handles 401s from WebID-OIDC resources by resending with credentials', async () => {
expect.assertions(1)
await saveSession(window.localStorage)({
=======
const matchAuthzHeader = (origin) => (headerVal) => {
const popToken = jwt.decode(headerVal[0].split(' ')[1])
return popToken.aud === origin &&
popToken.id_token === 'abc.def.ghi' &&
popToken.token_type === 'pop'
}
it('handles 401s from WebID-OIDC resources by resending with credentials', () => {
saveSession(window.localStorage)({
>>>>>>>
const matchAuthzHeader = origin => headerVal => {
const popToken = jwt.decode(headerVal[0].split(' ')[1])
return (
popToken.aud === origin &&
popToken.id_token === 'abc.def.ghi' &&
popToken.token_type === 'pop'
)
}
it('handles 401s from WebID-OIDC resources by resending with credentials', async () => {
expect.assertions(1)
await saveSession(window.localStorage)({ |
<<<<<<<
const level = require('level')
const levelMem = require('level-mem')
const { addHexPrefix, toBuffer } = require('ethereumjs-util')
=======
const { setupPreConditions, verifyPostConditions, getDAOCommon } = require('./util.js')
const { addHexPrefix, rlp, bufferToInt } = require('ethereumjs-util')
>>>>>>>
const level = require('level')
const levelMem = require('level-mem')
const { addHexPrefix, toBuffer, rlp, bufferToInt } = require('ethereumjs-util')
<<<<<<<
let common
if (options.forkConfigTestSuite == 'HomesteadToDaoAt5') {
common = getDAOCommon(5)
} else {
common = new Common({ chain: 'mainnet', hardfork, eips })
}
=======
const { common } = options
common.setHardforkByBlockNumber(0)
>>>>>>>
const { common } = options
common.setHardforkByBlockNumber(0)
<<<<<<<
currentBlock++
lastBlock = currentBlock == numBlocks
=======
lastBlock = currentBlock
>>>>>>>
lastBlock = currentBlock
<<<<<<<
const block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
common,
})
=======
let block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
common
})
currentBlock = bufferToInt(block.header.number)
} catch(e) {
handleError(e, expectException)
continue
}
>>>>>>>
const block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
common,
})
currentBlock = bufferToInt(block.header.number)
} catch (e) {
handleError(e, expectException)
continue
}
<<<<<<<
if (testData.lastblockhash.substr(0, 2) === '0x') {
// fix for BlockchainTests/GeneralStateTests/stRandom/*
testData.lastblockhash = testData.lastblockhash.substr(2)
}
if (expectException !== undefined && lastBlock) {
// only check last block hash on last block
t.equal(headBlock.hash().toString('hex'), testData.lastblockhash, 'last block hash')
}
=======
>>>>>>>
<<<<<<<
if (expectException !== undefined && lastBlock) {
t.equal(
blockchain.meta.rawHead.toString('hex'),
testData.lastblockhash,
'correct header block',
)
}
=======
>>>>>>> |
<<<<<<<
tape('Ensure that precompile activation creates non-empty accounts', async (t) => {
// setup the accounts for this test
const caller = Buffer.from('00000000000000000000000000000000000000ee', 'hex') // caller addres
const contractAddress = Buffer.from('00000000000000000000000000000000000000ff', 'hex') // contract address
// setup the vm
const common = new Common('mainnet', 'istanbul')
const vmNotActivated = new VM({ common: common})
const vmActivated = new VM({ common: common, activatePrecompiles: true})
const code = "6000808080347300000000000000000000000000000000000000045AF100"
/*
idea: call the Identity precompile with nonzero value in order to trigger "callNewAccount" for the non-activated VM and do not deduct this
when calling from the activated VM. Explicitly check that the difference in gas cost is equal to the common callNewAccount gas.
code: remarks: (top of the stack is at the zero index)
PUSH1 0x00
DUP1
DUP1
DUP1
CALLVALUE
PUSH20 0000000000000000000000000000000000000004
GAS
CALL [gas, 0x00..04, 0, 0, 0, 0, 0]
STOP
*/
await vmNotActivated.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
await vmActivated.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
// setup the call arguments
let runCallArgs = {
caller: caller, // call address
gasLimit: new BN(0xffffffffff), // ensure we pass a lot of gas, so we do not run out of gas
to: contractAddress, // call to the contract address,
value: new BN(1)
}
const resultNotActivated = await vmNotActivated.runCall(runCallArgs)
const resultActivated = await vmActivated.runCall(runCallArgs)
const diff = resultNotActivated.gasUsed.sub(resultActivated.gasUsed)
const expected = common.param('gasPrices', 'callNewAccount')
t.assert(diff.eq(new BN(expected)), "precompiles are activated")
t.end()
})
=======
tape('Byzantium cannot access Constantinople opcodes', async (t) => {
t.plan(2)
// setup the accounts for this test
const caller = Buffer.from('00000000000000000000000000000000000000ee', 'hex') // caller addres
const contractAddress = Buffer.from('00000000000000000000000000000000000000ff', 'hex') // contract address
// setup the vm
const vmByzantium = new VM({ chain: 'mainnet', hardfork: 'byzantium'})
const vmConstantinople = new VM({ chain: 'mainnet', hardfork: 'constantinople'})
const code = "600160011B00"
/*
code: remarks: (top of the stack is at the zero index)
PUSH1 0x01
PUSH1 0x01
SHL
STOP
*/
await vmByzantium.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
await vmConstantinople.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
const runCallArgs = {
caller: caller, // call address
gasLimit: new BN(0xffffffffff), // ensure we pass a lot of gas, so we do not run out of gas
to: contractAddress, // call to the contract address
}
const byzantiumResult = await vmByzantium.runCall(runCallArgs)
const constantinopleResult = await vmConstantinople.runCall(runCallArgs)
t.assert(byzantiumResult.execResult.exceptionError && byzantiumResult.execResult.exceptionError.error === 'invalid opcode', 'byzantium cannot accept constantinople opcodes (SHL)')
t.assert(!constantinopleResult.execResult.exceptionError, 'constantinople can access the SHL opcode')
t.end()
})
>>>>>>>
tape('Byzantium cannot access Constantinople opcodes', async (t) => {
t.plan(2)
// setup the accounts for this test
const caller = Buffer.from('00000000000000000000000000000000000000ee', 'hex') // caller addres
const contractAddress = Buffer.from('00000000000000000000000000000000000000ff', 'hex') // contract address
// setup the vm
const vmByzantium = new VM({ chain: 'mainnet', hardfork: 'byzantium'})
const vmConstantinople = new VM({ chain: 'mainnet', hardfork: 'constantinople'})
const code = "600160011B00"
/*
code: remarks: (top of the stack is at the zero index)
PUSH1 0x01
PUSH1 0x01
SHL
STOP
*/
await vmByzantium.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
await vmConstantinople.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
const runCallArgs = {
caller: caller, // call address
gasLimit: new BN(0xffffffffff), // ensure we pass a lot of gas, so we do not run out of gas
to: contractAddress, // call to the contract address
}
const byzantiumResult = await vmByzantium.runCall(runCallArgs)
const constantinopleResult = await vmConstantinople.runCall(runCallArgs)
t.assert(byzantiumResult.execResult.exceptionError && byzantiumResult.execResult.exceptionError.error === 'invalid opcode', 'byzantium cannot accept constantinople opcodes (SHL)')
t.assert(!constantinopleResult.execResult.exceptionError, 'constantinople can access the SHL opcode')
t.end()
})
tape('Ensure that precompile activation creates non-empty accounts', async (t) => {
// setup the accounts for this test
const caller = Buffer.from('00000000000000000000000000000000000000ee', 'hex') // caller addres
const contractAddress = Buffer.from('00000000000000000000000000000000000000ff', 'hex') // contract address
// setup the vm
const common = new Common('mainnet', 'istanbul')
const vmNotActivated = new VM({ common: common})
const vmActivated = new VM({ common: common, activatePrecompiles: true})
const code = "6000808080347300000000000000000000000000000000000000045AF100"
/*
idea: call the Identity precompile with nonzero value in order to trigger "callNewAccount" for the non-activated VM and do not deduct this
when calling from the activated VM. Explicitly check that the difference in gas cost is equal to the common callNewAccount gas.
code: remarks: (top of the stack is at the zero index)
PUSH1 0x00
DUP1
DUP1
DUP1
CALLVALUE
PUSH20 0000000000000000000000000000000000000004
GAS
CALL [gas, 0x00..04, 0, 0, 0, 0, 0]
STOP
*/
await vmNotActivated.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
await vmActivated.stateManager.putContractCode(contractAddress, Buffer.from(code, 'hex')) // setup the contract code
// setup the call arguments
let runCallArgs = {
caller: caller, // call address
gasLimit: new BN(0xffffffffff), // ensure we pass a lot of gas, so we do not run out of gas
to: contractAddress, // call to the contract address,
value: new BN(1)
}
const resultNotActivated = await vmNotActivated.runCall(runCallArgs)
const resultActivated = await vmActivated.runCall(runCallArgs)
const diff = resultNotActivated.gasUsed.sub(resultActivated.gasUsed)
const expected = common.param('gasPrices', 'callNewAccount')
t.assert(diff.eq(new BN(expected)), "precompiles are activated")
t.end()
}) |
<<<<<<<
const level = require('level')
const levelMem = require('level-mem')
const { promisify } = require('util')
const { addHexPrefix, toBuffer } = require('ethereumjs-util')
=======
const { setupPreConditions, verifyPostConditions, getDAOCommon } = require('./util.js')
const { addHexPrefix } = require('ethereumjs-util')
>>>>>>>
const level = require('level')
const levelMem = require('level-mem')
const { addHexPrefix } = require('ethereumjs-util')
<<<<<<<
const Common = require('@ethereumjs/common').default
const { setupPreConditions, verifyPostConditions } = require('./util.js')
=======
const Common = require('@ethereumjs/common').default
const level = require('level')
const levelMem = require('level-mem')
>>>>>>>
const Common = require('@ethereumjs/common').default
const { setupPreConditions, verifyPostConditions, getDAOCommon } = require('./util.js')
<<<<<<<
const state = new Trie()
=======
// ensure that the test data is the right fork data
if (testData.network != options.forkConfigTestSuite) {
t.comment('skipping test: no data available for ' + options.forkConfigTestSuite)
return
}
>>>>>>>
// ensure that the test data is the right fork data
if (testData.network != options.forkConfigTestSuite) {
t.comment('skipping test: no data available for ' + options.forkConfigTestSuite)
return
}
<<<<<<<
=======
const state = new Trie()
>>>>>>>
const state = new Trie()
<<<<<<<
const hardfork = options.forkConfigVM
const common = new Common('mainnet', hardfork)
=======
const common = (options.forkConfigTestSuite == "HomesteadToDaoAt5") ? getDAOCommon(5) : new Common('mainnet', options.forkConfigVM)
>>>>>>>
const common =
options.forkConfigTestSuite == 'HomesteadToDaoAt5'
? getDAOCommon(5)
: new Common('mainnet', options.forkConfigVM)
<<<<<<<
common,
validate,
=======
common,
validateBlocks: validate,
validatePow: validate,
>>>>>>>
common,
validateBlocks: validate,
validatePow: validate,
<<<<<<<
const VM = options.dist ? require('../dist/index.js').default : require('../lib/index').default
=======
let VM
if (options.dist) {
VM = require('../dist/index.js').default
} else {
VM = require('../lib/index').default
}
>>>>>>>
let VM
if (options.dist) {
VM = require('../dist/index.js').default
} else {
VM = require('../lib/index').default
}
<<<<<<<
blockchain,
hardfork,
=======
blockchain,
common,
>>>>>>>
blockchain,
common,
<<<<<<<
const formattedBlockHeaderData = formatBlockHeader(testData.genesisBlockHeader)
genesisBlock.header = new BlockHeader(formattedBlockHeaderData, { common })
const stateManagerStateRoot = vm.stateManager._trie.root
t.ok(stateManagerStateRoot.equals(genesisBlock.header.stateRoot), 'correct pre stateRoot')
=======
genesisBlock.header = new BlockHeader(formatBlockHeader(testData.genesisBlockHeader), {
common,
})
t.ok(vm.stateManager._trie.root.equals(genesisBlock.header.stateRoot), 'correct pre stateRoot')
>>>>>>>
genesisBlock.header = new BlockHeader(formatBlockHeader(testData.genesisBlockHeader), {
common,
})
t.ok(vm.stateManager._trie.root.equals(genesisBlock.header.stateRoot), 'correct pre stateRoot')
<<<<<<<
const putGenesisAsync = promisify(blockchain.putGenesis).bind(blockchain)
await putGenesisAsync(genesisBlock)
=======
await blockchain.putGenesis(genesisBlock)
>>>>>>>
await blockchain.putGenesis(genesisBlock)
<<<<<<<
const block = new Block(toBuffer(raw.rlp), { common })
const putBlockAsync = promisify(blockchain.putBlock).bind(blockchain)
=======
const block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
common
})
>>>>>>>
const block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
common,
})
<<<<<<<
const lastblockhash = toBuffer(testData.lastblockhash)
if (expectException !== undefined) {
t.ok(headBlock.hash().equals(lastblockhash), 'correct last block hash')
=======
if (testData.lastblockhash.substr(0, 2) === '0x') {
// fix for BlockchainTests/GeneralStateTests/stRandom/*
testData.lastblockhash = testData.lastblockhash.substr(2)
}
if (expectException !== undefined && lastBlock) { // only check last block hash on last block
t.equal(headBlock.hash().toString('hex'), testData.lastblockhash, 'last block hash')
>>>>>>>
if (testData.lastblockhash.substr(0, 2) === '0x') {
// fix for BlockchainTests/GeneralStateTests/stRandom/*
testData.lastblockhash = testData.lastblockhash.substr(2)
}
if (expectException !== undefined && lastBlock) {
// only check last block hash on last block
t.equal(headBlock.hash().toString('hex'), testData.lastblockhash, 'last block hash')
<<<<<<<
if (expectException !== undefined) {
const rawHead = toBuffer(blockchain.meta.rawHead)
t.ok(rawHead.equals(lastblockhash), 'correct header block')
=======
if (expectException !== undefined && lastBlock) {
t.equal(
blockchain.meta.rawHead.toString('hex'),
testData.lastblockhash,
'correct header block',
)
>>>>>>>
if (expectException !== undefined && lastBlock) {
t.equal(
blockchain.meta.rawHead.toString('hex'),
testData.lastblockhash,
'correct header block',
) |
<<<<<<<
coreHelpers.tag_cloud = require('./tag_cloud');
coreHelpers.ghost_script_tags = require('./ghost_script_tags');
=======
coreHelpers.prev_post = require('./prev_next');
coreHelpers.next_post = require('./prev_next');
>>>>>>>
coreHelpers.tag_cloud = require('./tag_cloud');
coreHelpers.prev_post = require('./prev_next');
coreHelpers.next_post = require('./prev_next');
<<<<<<<
registerAsyncThemeHelper('tag_cloud', coreHelpers.tag_cloud);
=======
registerAsyncThemeHelper('next_post', coreHelpers.next_post);
registerAsyncThemeHelper('prev_post', coreHelpers.prev_post);
>>>>>>>
registerAsyncThemeHelper('tag_cloud', coreHelpers.tag_cloud);
registerAsyncThemeHelper('next_post', coreHelpers.next_post);
registerAsyncThemeHelper('prev_post', coreHelpers.prev_post); |
<<<<<<<
Revolver.prototype.VERSION = '1.0.5'; // version info
=======
Revolver.prototype.VERSION = '1.0.6'; // version info
>>>>>>>
Revolver.prototype.VERSION = '1.0.6'; // version info
<<<<<<<
var revolver, easingMap, easing, nextSlide, nextSlidePromise, currentSlide;
=======
var revolver, easingMap, easing, nextSlide, currentSlide, nextSlidePromise;
>>>>>>>
var revolver, easingMap, easing, nextSlide, nextSlidePromise, currentSlide;
var revolver, easingMap, easing, nextSlide, currentSlide, nextSlidePromise; |
<<<<<<<
var hashStartRe = /{$|{ $/;
=======
var hashStartingRe = /{$|{ $/;
var stripMixinsRe = /(\(.*\))/;
>>>>>>>
var hashStartRe = /{$|{ $/;
var stripMixinsRe = /(\(.*\))/;
<<<<<<<
if ( hashStartRe.test(app.cache.line) &&
app.cache.line.indexOf('=') !== -1 ) {
hashStart = true;
=======
if ( hashStartingRe.test(newLine) && newLine.indexOf('= ') !== -1 && newLine.indexOf('*=') === -1 ) {
return true;
}
else {
return false;
>>>>>>>
if ( hashStartRe.test(strippedLine) &&
strippedLine.indexOf('=') !== -1 ) {
hashStart = true; |
<<<<<<<
it('should return undefined if dir not string', function() {
assert.equal( undefined, app.ver( app, 0 ) );
});
=======
// it('should throw if no package.json found', function() {
// should.Throw(function() {
// app.ver( 5 );
// }, Error);
// });
>>>>>>>
it('should return undefined if dir not string', function() {
assert.equal( undefined, app.ver( app, 0 ) );
});
<<<<<<<
assert.equal( false, app.efficient( 'margin 0 0 0 0' ) );
assert.equal( false, app.efficient( 'margin: 0 0 0' ) );
assert.equal( false, app.efficient( 'margin 0 0' ) );
assert.equal( false, app.efficient( 'margin: 0 5px 0 5px' ) );
assert.equal( false, app.efficient( 'margin 5px 0 5px' ) );
assert.equal( false, app.efficient( 'margin: 5px 0 5px 0' ) );
assert.equal( false, app.efficient( 'margin 0 5px 0' ) );
assert.equal( false, app.efficient( 'margin: 0 5px 5px 5px' ) );
assert.equal( false, app.efficient( 'padding 0 0 0 0' ) );
assert.equal( false, app.efficient( 'padding: 0 0 0' ) );
assert.equal( false, app.efficient( 'padding 0 0' ) );
assert.equal( false, app.efficient( 'padding: 0 5px 0 5px' ) );
assert.equal( false, app.efficient( 'padding 5px 0 5px' ) );
assert.equal( false, app.efficient( 'padding: 5px 0 5px 0' ) );
assert.equal( false, app.efficient( 'padding 0 5px 0' ) );
assert.equal( false, app.efficient( 'padding: 0 5px 5px 5px' ) );
=======
assert.equal( false, app.efficient( test1, test1.split(' ') ) );
assert.equal( false, app.efficient( test2, test2.split(' ') ) );
assert.equal( false, app.efficient( test3, test3.split(' ') ) );
assert.equal( false, app.efficient( test4, test4.split(' ') ) );
assert.equal( false, app.efficient( test5, test5.split(' ') ) );
assert.equal( false, app.efficient( test6, test6.split(' ') ) );
assert.equal( false, app.efficient( test7, test7.split(' ') ) );
assert.equal( false, app.efficient( test15, test15.split(' ') ) );
>>>>>>>
assert.equal( false, app.efficient( 'margin 0 0 0 0' ) );
assert.equal( false, app.efficient( 'margin: 0 0 0' ) );
assert.equal( false, app.efficient( 'margin 0 0' ) );
assert.equal( false, app.efficient( 'margin: 0 5px 0 5px' ) );
assert.equal( false, app.efficient( 'margin 5px 0 5px' ) );
assert.equal( false, app.efficient( 'margin: 5px 0 5px 0' ) );
assert.equal( false, app.efficient( 'margin 0 5px 0' ) );
assert.equal( false, app.efficient( 'margin: 0 5px 5px 5px' ) );
assert.equal( false, app.efficient( 'padding 0 0 0 0' ) );
assert.equal( false, app.efficient( 'padding: 0 0 0' ) );
assert.equal( false, app.efficient( 'padding 0 0' ) );
assert.equal( false, app.efficient( 'padding: 0 5px 0 5px' ) );
assert.equal( false, app.efficient( 'padding 5px 0 5px' ) );
assert.equal( false, app.efficient( 'padding: 5px 0 5px 0' ) );
assert.equal( false, app.efficient( 'padding 0 5px 0' ) );
assert.equal( false, app.efficient( 'padding: 0 5px 5px 5px' ) );
<<<<<<<
assert.equal( true, app.efficient( 'margin 0 5px' ) );
assert.equal( true, app.efficient( 'margin: 5px 0' ) );
assert.equal( true, app.efficient( 'margin 5px 0 0' ) );
assert.equal( true, app.efficient( 'margin: 0' ) );
assert.equal( true, app.efficient( 'margin 5px' ) );
assert.equal( true, app.efficient( 'padding 0 5px' ) );
assert.equal( true, app.efficient( 'padding: 5px 0' ) );
assert.equal( true, app.efficient( 'padding 5px 0 0' ) );
assert.equal( true, app.efficient( 'padding: 0' ) );
assert.equal( true, app.efficient( 'padding 5px' ) );
assert.equal( true, app.efficient( 'padding: 1px 2px 3px 4px' ) );
});
it('should return undefined if no margin or padding found', function() {
assert.equal( undefined, app.efficient( '.border-strong' ) );
})
=======
assert.equal( true, app.efficient( test8, test8.split(' ') ) );
assert.equal( true, app.efficient( test9, test9.split(' ') ) );
assert.equal( true, app.efficient( test10, test10.split(' ') ) );
assert.equal( true, app.efficient( test11, test11.split(' ') ) );
assert.equal( true, app.efficient( test12, test12.split(' ') ) );
assert.equal( true, app.efficient( test14, test14.split(' ') ) );
});
>>>>>>>
assert.equal( true, app.efficient( 'margin 0 5px' ) );
assert.equal( true, app.efficient( 'margin: 5px 0' ) );
assert.equal( true, app.efficient( 'margin 5px 0 0' ) );
assert.equal( true, app.efficient( 'margin: 0' ) );
assert.equal( true, app.efficient( 'margin 5px' ) );
assert.equal( true, app.efficient( 'padding 0 5px' ) );
assert.equal( true, app.efficient( 'padding: 5px 0' ) );
assert.equal( true, app.efficient( 'padding 5px 0 0' ) );
assert.equal( true, app.efficient( 'padding: 0' ) );
assert.equal( true, app.efficient( 'padding 5px' ) );
assert.equal( true, app.efficient( 'padding: 1px 2px 3px 4px' ) );
});
it('should return undefined if no margin or padding found', function() {
assert.equal( undefined, app.efficient( '.border-strong' ) );
})
<<<<<<<
it('should return false if correct quote style used', function() {
assert.equal( false, app.quotes( "$var = 'test string' ", 'single' ) );
assert.equal( false, app.quotes( "$var = 'test \"substring\" string' ", 'single' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' )", 'single' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' ) {", 'single' ) );
assert.equal( false, app.quotes( "[class*='--button']", 'single' ) );
assert.equal( false, app.quotes( '$var = "test string" ', 'double' ) );
assert.equal( false, app.quotes( '$var = "test \'substring\' string" ', 'double' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" )', 'double' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" ) {', 'double' ) );
assert.equal( false, app.quotes( '[class*="--button"]', 'double' ) );
});
it('should return false if no quotes found', function() {
assert.equal( false, app.quotes( '$var = #000 ', 'single' ) );
assert.equal( false, app.quotes( '$var = #000 ', 'double' ) );
});
it('should return true if incorrect quote style used', function() {
assert.equal( true, app.quotes( '$var = "test string" ', 'single' ) );
assert.equal( true, app.quotes( '$var = "test \'substring\' string"', 'single' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" )', 'single' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( true, app.quotes( '[class*="--button"]', 'single' ) );
assert.equal( true, app.quotes( "$var = 'test string' ", 'double' ) );
assert.equal( true, app.quotes( "$var = 'test \"substring\" string' ", 'double' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' )", 'double' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' ) {", 'double' ) );
assert.equal( true, app.quotes( "[class*='--button']", 'double' ) );
=======
it('should return false if incorrect quote style used', function() {
assert.equal( false, app.quotes( '$var = "test string" ', 'single' ) );
assert.equal( false, app.quotes( '$var = "test \'substring\' string"', 'single' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" )', 'single' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( false, app.quotes( '[class*="--button"]', 'single' ) );
assert.equal( false, app.quotes( '[class*="--button"] {', 'single' ) );
assert.equal( false, app.quotes( 'show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( false, app.quotes( "$var = 'test string' ", 'double' ) );
assert.equal( false, app.quotes( "$var = 'test \"substring\" string' ", 'double' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' )", 'double' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' ) {", 'double' ) );
assert.equal( false, app.quotes( "[class*='--button']", 'double' ) );
assert.equal( false, app.quotes( "[class*='--button'] {", 'double' ) );
assert.equal( false, app.quotes( "show-content( $content = 'Hello!' ) {", 'double' ) );
});
it('should return true if correct quote style used', function() {
assert.equal( true, app.quotes( "$var = 'test string' ", 'single' ) );
assert.equal( true, app.quotes( "$var = 'test \"substring\" string' ", 'single' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' )", 'single' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' ) {", 'single' ) );
assert.equal( true, app.quotes( "[class*='--button']", 'single' ) );
assert.equal( true, app.quotes( '$var = "test string" ', 'double' ) );
assert.equal( true, app.quotes( '$var = "test \'substring\' string" ', 'double' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" )', 'double' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" ) {', 'double' ) );
assert.equal( true, app.quotes( '[class*="--button"]', 'double' ) );
});
it('should return undefined if no quotes found', function() {
assert.equal( undefined, app.quotes( '$var = #000 ', 'single' ) );
assert.equal( undefined, app.quotes( '$var = #000 ', 'double' ) );
>>>>>>>
it('should return false if correct quote style used', function() {
assert.equal( false, app.quotes( '$var = "test string" ', 'single' ) );
assert.equal( false, app.quotes( '$var = "test \'substring\' string"', 'single' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" )', 'single' ) );
assert.equal( false, app.quotes( '.show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( false, app.quotes( '[class*="--button"]', 'single' ) );
assert.equal( false, app.quotes( '[class*="--button"] {', 'single' ) );
assert.equal( false, app.quotes( 'show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( false, app.quotes( "$var = 'test string' ", 'double' ) );
assert.equal( false, app.quotes( "$var = 'test \"substring\" string' ", 'double' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' )", 'double' ) );
assert.equal( false, app.quotes( ".show-content( $content = 'Hello!' ) {", 'double' ) );
assert.equal( false, app.quotes( "[class*='--button']", 'double' ) );
assert.equal( false, app.quotes( "[class*='--button'] {", 'double' ) );
assert.equal( false, app.quotes( "show-content( $content = 'Hello!' ) {", 'double' ) );
});
it('should return false if no quotes found', function() {
assert.equal( false, app.quotes( '$var = #000 ', 'single' ) );
assert.equal( false, app.quotes( '$var = #000 ', 'double' ) );
});
it('should return true if incorrect quote style used', function() {
assert.equal( true, app.quotes( '$var = "test string" ', 'single' ) );
assert.equal( true, app.quotes( '$var = "test \'substring\' string"', 'single' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" )', 'single' ) );
assert.equal( true, app.quotes( '.show-content( $content = "Hello!" ) {', 'single' ) );
assert.equal( true, app.quotes( '[class*="--button"]', 'single' ) );
assert.equal( true, app.quotes( "$var = 'test string' ", 'double' ) );
assert.equal( true, app.quotes( "$var = 'test \"substring\" string' ", 'double' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' )", 'double' ) );
assert.equal( true, app.quotes( ".show-content( $content = 'Hello!' ) {", 'double' ) );
assert.equal( true, app.quotes( "[class*='--button']", 'double' ) ); |
<<<<<<<
if ( badConvention ) {
this.msg( 'preferred naming convention is ' + this.state.conf )
=======
if ( badConvention === true ) {
this.msg( 'preferred naming convention is ' + this.config.namingConvention )
>>>>>>>
if ( badConvention === true ) {
this.msg( 'preferred naming convention is ' + this.state.conf ) |
<<<<<<<
graphicColors: [],
legends: [],
type: ""
=======
loadingGrafics:[],
>>>>>>>
loadingGrafics:[],
<<<<<<<
ReportsService.loading({opportunity_id: MapasCulturais.entity.id}).success(function (data, status, headers){
var reportData = data.map(function(item, index){
return {
identifier: item.value.identifier,
configGrafic:{
graficId:item.id,
title: item.value.reportData.title,
description: item.value.reportData.description,
opportunity_id: item.value.reportData.opportunity_id,
},
reportData:{
graficType: item.value.reportData.typeGrafic,
dataA: item.value.reportData.columns[0],
dataB: item.value.reportData.columns[1],
},
}
});
reportData.forEach(function(index){
ReportsService.create({reportData: index.reportData}).success(function (data, status, headers){
$scope.graficGenerate(data, index.configGrafic, index.identifier);
});
});
=======
ReportsService.loading({opportunity_id: MapasCulturais.entity.id}).success(function (data, status, headers){
$scope.data.loadingGrafics = data;
$scope.graficGenerate();
>>>>>>>
ReportsService.loading({opportunity_id: MapasCulturais.entity.id}).success(function (data, status, headers){
$scope.data.loadingGrafics = data;
$scope.graficGenerate();
<<<<<<<
$scope.createHtmlGraphic = function(element, reportData, identifier, configGrafic){
var newGrafic = document.getElementById(element);
/**
* Cria os elementos
*/
var chartWrap = document.createElement("div");
var header = document.createElement("header");
var title = document.createElement("h3");
var button = document.createElement("a");
var chartContainer = document.createElement("div");
var canvas = document.createElement("canvas");
var footer = document.createElement("footer");
var legendsChats = document.createElement("div");
/**
* Nível 1
*/
chartWrap.appendChild(header);
chartWrap.appendChild(chartContainer);
chartWrap.appendChild(footer);
/**
* Nível 2
*/
header.appendChild(title);
header.appendChild(button);
chartContainer.appendChild(canvas);
footer.appendChild(legendsChats);
/**
* Atributos
*/
chartWrap.style.height = "auto";
chartWrap.classList.add("chart-wrap")
button.classList.add('hltip','download');
chartContainer.classList.add('chart-container','chart-'+reportData.typeGrafic);
chartContainer.style.position = "relative";
canvas.id = "dinamic-grafic"+identifier;
legendsChats.classList.add("legends-chats");
legendsChats.id = "dinamic-legends"+identifier;
title.textContent = configGrafic.title;
/**
* Condicionais
*/
chartContainer.style.width = (reportData.typeGrafic == "pie") ? "60%" : "100%";
newGrafic.appendChild(chartWrap);
=======
$scope.getLabelColor = function(graphic, index){
if(graphic.reportData.typeGrafic == "line"){
return graphic.data.series[index].colors;
}else{
return graphic.data.backgroundColor[index];
}
}
$scope.clearModal = function() {
$scope.data.reportModal = false;
$scope.data.graficData = false;
$scope.data.reportData.type = '';
$scope.data.reportData.title = '';
$scope.data.reportData.description = '';
$scope.data.reportData.dataDisplayA = '';
$scope.data.reportData.dataDisplayB = '';
>>>>>>>
$scope.getLabelColor = function(graphic, index){
if(graphic.reportData.typeGrafic == "line"){
return graphic.data.series[index].colors;
}else{
return graphic.data.backgroundColor[index];
}
}
$scope.clearModal = function() {
$scope.data.reportModal = false;
$scope.data.graficData = false;
$scope.data.reportData.type = '';
$scope.data.reportData.title = '';
$scope.data.reportData.description = '';
$scope.data.reportData.dataDisplayA = '';
$scope.data.reportData.dataDisplayB = '';
<<<<<<<
},
remove: function (data) {
var url = MapasCulturais.createUrl('reports', 'deleteGraphic', { opportunity_id: MapasCulturais.entity.id, graphic_id: data });
return $http.delete(url).
success(function (data, status, headers) {
$rootScope.$emit('reports.remove', { message: "Reports deleted", data: data, status: status });
}).error(function (data, status) {
$rootScope.$emit('error', { message: "Reports not deleted for this opportunity", data: data, status: status });
});
=======
>>>>>>>
},
remove: function (data) {
var url = MapasCulturais.createUrl('reports', 'deleteGraphic', { opportunity_id: MapasCulturais.entity.id, graphic_id: data });
return $http.delete(url).
success(function (data, status, headers) {
$rootScope.$emit('reports.remove', { message: "Reports deleted", data: data, status: status });
}).error(function (data, status) {
$rootScope.$emit('error', { message: "Reports not deleted for this opportunity", data: data, status: status });
}); |
<<<<<<<
=======
},
send: function(registrationId){
alert(getUrl('send', registrationId));
>>>>>>>
},
send: function(registrationId){
alert(getUrl('send', registrationId)); |
<<<<<<<
// Não adiciona os metadados geograficos que devem ser ocultos (que começam com "_")
if (prop.substr(0,4) == 'geo_')
return;
exportSelect.push(selectProperty);
=======
exportSelect.push(selectProperty);
>>>>>>>
// Não adiciona os metadados geograficos que devem ser ocultos (que começam com "_")
if (prop.substr(0,4) == 'geo_')
return;
exportSelect.push(selectProperty);
<<<<<<<
=======
>>>>>>> |
<<<<<<<
expect(autocomplete.selectedIndex).toBe(-1);
expect(suggestionsContainer.find('.autocomplete-no-suggestion').length).toBe(1);
expect(suggestionsContainer.find('.autocomplete-no-suggestion').text()).toBe('Sorry, no matching results');
});
});
describe('When options.preserveInput is true', function () {
'use strict';
var input = $('<input />'),
instance,
suggestionData = null;
beforeEach(function () {
input.autocomplete({
lookup: [{ value: 'Jamaica', data: 'J' }, { value: 'Jamaica2', data: 'J' }, { value: 'Jamaica3', data: 'J' }],
preserveInput: true,
onSelect: function (suggestion) {
suggestionData = suggestion.data;
}
});
input.val('J');
instance = input.autocomplete();
});
afterEach(function () {
instance.dispose();
=======
expect(autocomplete.selectedIndex).toBe(-1)
expect(suggestionsContainer.find('.autocomplete-no-suggestion').length).toBe(1)
expect(suggestionsContainer.find('.autocomplete-no-suggestion').text()).toBe('Sorry, no matching results')
});
it('Should call onHide and pass container jQuery object', function () {
var element = document.createElement('input'),
input = $(element),
instance,
elementCount,
context;
input.autocomplete({
lookup: [{ value: 'Jamaica', data: 'B' }],
onHide: function (container) {
context = this;
elementCount = container.length;
}
});
input.val('Jam');
instance = input.autocomplete();
instance.onValueChange();
input.val('Colombia');
instance.onValueChange();
expect(context).toBe(element);
expect(elementCount).toBe(1);
>>>>>>>
expect(autocomplete.selectedIndex).toBe(-1);
expect(suggestionsContainer.find('.autocomplete-no-suggestion').length).toBe(1);
expect(suggestionsContainer.find('.autocomplete-no-suggestion').text()).toBe('Sorry, no matching results');
});
it('Should call onHide and pass container jQuery object', function () {
var element = document.createElement('input'),
input = $(element),
instance,
elementCount,
context;
input.autocomplete({
lookup: [{ value: 'Jamaica', data: 'B' }],
onHide: function (container) {
context = this;
elementCount = container.length;
}
});
input.val('Jam');
instance = input.autocomplete();
instance.onValueChange();
input.val('Colombia');
instance.onValueChange();
expect(context).toBe(element);
expect(elementCount).toBe(1);
});
});
describe('When options.preserveInput is true', function () {
'use strict';
var input = $('<input />'),
instance,
suggestionData = null;
beforeEach(function () {
input.autocomplete({
lookup: [{ value: 'Jamaica', data: 'J' }, { value: 'Jamaica2', data: 'J' }, { value: 'Jamaica3', data: 'J' }],
preserveInput: true,
onSelect: function (suggestion) {
suggestionData = suggestion.data;
}
});
input.val('J');
instance = input.autocomplete();
});
afterEach(function () {
instance.dispose(); |
<<<<<<<
if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
this.hide();
}
=======
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
>>>>>>>
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
this.hide();
} |
<<<<<<<
containerClass: 'autocomplete-suggestions',
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
}
=======
containerClass: 'autocomplete-suggestions',
tabDisabled: false
>>>>>>>
containerClass: 'autocomplete-suggestions',
tabDisabled: false,
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
}
<<<<<<<
that.select(that.selectedIndex);
if (e.keyCode === keys.TAB) {
=======
this.select(this.selectedIndex);
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) {
>>>>>>>
that.select(that.selectedIndex);
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) { |
<<<<<<<
removeMessage,
is_hap
=======
removeMessage,
onCloseEmoji
>>>>>>>
removeMessage,
is_hap,
onCloseEmoji
<<<<<<<
is_hap={is_hap}
=======
onCloseEmoji={onCloseEmoji}
>>>>>>>
is_hap={is_hap}
onCloseEmoji={onCloseEmoji} |
<<<<<<<
checkForImageError(imageArray);
document.getElementById('downloaded_from').innerHTML = 'Assets got from PEER!!';
=======
>>>>>>>
checkForImageError(imageArray);
document.getElementById('downloaded_from').innerHTML = 'Assets got from PEER!!';
<<<<<<<
return canvas.toDataURL(`image/${type}`);
=======
return canvas.toDataURL();
>>>>>>>
return canvas.toDataURL(`image/${type}`);
<<<<<<<
=======
function imageNotFound(imageSrc) {
console.log('this is not working!');
// document.querySelector(`[data-src='${imageSrc}']`).setAttribute('src', `${imageSrc}`);
}
// function that reports time to DOM
function reportTime(time, currentOrTotal, domId) {
time = new Date();
document.getElementById(domId).innerHTML += `<span class="bold">${time - currentOrTotal} ms</span>`;
currentTime = new Date();
}
>>>>>>>
// function that reports time to DOM
function reportTime(time, currentOrTotal, domId) {
time = new Date();
document.getElementById(domId).innerHTML += `<span class="bold">${time - currentOrTotal} ms</span>`;
currentTime = new Date();
} |
<<<<<<<
//assign ids to image
for (let key in imageArray) {
if (!isNaN(key)) imageArray[key].setAttribute('id', key);
}
//image Id to append timestamp on each image
let imageId = 0;
=======
// checks if broswer is opened from mobile
const isMobile = checkForMobile()
console.log('Am I on mobile?: ', isMobile)
// Establish connection if not mobile
// if mobile load from server and don't create a socket connection
isMobile ? loadAssetsFromServer() : socket = io.connect()
>>>>>>>
//assign ids to image
for (let key in imageArray) {
if (!isNaN(key)) imageArray[key].setAttribute('id', key);
}
//image Id to append timestamp on each image
let imageId = 0;
// checks if broswer is opened from mobile
const isMobile = checkForMobile()
console.log('Am I on mobile?: ', isMobile)
// Establish connection if not mobile
// if mobile load from server and don't create a socket connection
isMobile ? loadAssetsFromServer() : socket = io.connect()
<<<<<<<
const location = initiatorData.location
document.getElementsByClassName('loading_gif')[0].style.display = 'none';
document.getElementById('downloaded_from').innerHTML = 'Assets downloaded from a PEER!';
document.getElementById('downloaded_from').style.display = '';
document.getElementById('report').style.display = '';
document.getElementById('peer_info').style.display = '';
document.getElementById('peer_info').innerHTML +=
`<br>* Received data from ${location.city}, ${location.regionCode}, ${location.country} ${location.zipCode};`;
=======
if (initiatorData.location) {
const location = initiatorData.location
document.getElementById('peer_info').innerHTML +=
`<br>* Received data from ${location.city}, ${location.regionCode}, ${location.country} ${location.zipCode};`;
}
>>>>>>>
document.getElementsByClassName('loading_gif')[0].style.display = 'none';
document.getElementById('downloaded_from').innerHTML = 'Assets downloaded from a PEER!';
document.getElementById('downloaded_from').style.display = '';
document.getElementById('report').style.display = '';
document.getElementById('peer_info').style.display = '';
if (initiatorData.location) {
const location = initiatorData.location
document.getElementById('peer_info').innerHTML +=
`<br>* Received data from ${location.city}, ${location.regionCode}, ${location.country} ${location.zipCode};`;
}
<<<<<<<
document.getElementById('peer_info').style.display = '';
document.getElementById('peer_info').innerHTML +=
`<br>* Sent data to ${peerLocation.city}, ${peerLocation.regionCode}, ${peerLocation.country} ${peerLocation.zipCode};`;
=======
if (peerLocation) {
document.getElementById('peer_info').innerHTML +=
`<br>* Sent data to ${peerLocation.city}, ${peerLocation.regionCode}, ${peerLocation.country} ${peerLocation.zipCode};`;
}
>>>>>>>
document.getElementById('peer_info').style.display = '';
if (peerLocation) {
document.getElementById('peer_info').innerHTML +=
`<br>* Sent data to ${peerLocation.city}, ${peerLocation.regionCode}, ${peerLocation.country} ${peerLocation.zipCode};`;
}
<<<<<<<
loopImg();
// let blob = new Blob( [ data ], { type: "image/png" } );
// console.log('DATA: ', new TextDecoder("utf-8").decode(data));
// console.log('DATA: ', imageData);
if (data.toString().slice(0, 12) == "FINISHED-YUY") {
counter++;
console.log("Received all data for an image. Setting image.");
// reportTime(dataReceivedTime, currentTime, 'time_to_receive');
//append time it took to receive image data
document.getElementById(imageId).parentNode.appendChild(document.createTextNode(`${new Date() - currentTime} ms`));
currentTime = new Date();
imageId += 1;
if (!isElementInViewport(imageArray[data.slice(12)])) {
if (imageData.slice(0, 9) === 'undefined') imageArray[data.slice(12)].src = imageData.slice(9);
else imageArray[data.slice(12)].src = imageData
=======
>>>>>>>
<<<<<<<
currentTime = new Date();
p.destroy();
=======
p.destroy();
document.getElementById('downloaded_from').innerHTML = 'Assets got from PEER!!';
>>>>>>>
currentTime = new Date();
p.destroy();
<<<<<<<
// take off loading gif
document.getElementsByClassName('loading_gif')[0].style.display = 'none';
=======
>>>>>>>
// take off loading gif
document.getElementsByClassName('loading_gif')[0].style.display = 'none';
<<<<<<<
// let myData = context.getImageData(0, 0, img.width, img.height);
=======
>>>>>>>
<<<<<<<
}
// function that reports time to DOM
function reportTime(time, currentOrTotal, domId) {
time = new Date();
document.getElementById(domId).innerHTML += `<span class="bold">${time - currentOrTotal} ms</span>`;
currentTime = new Date();
=======
}
function checkForMobile() {
testExp = new RegExp('Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile', 'i');
return testExp.test(navigator.userAgent) ? true : false;
}
function setServerImage(imageSource) {
document.querySelector(`[data-src='${imageSource}']`).setAttribute('src', `${imageSource}`);
>>>>>>>
}
// function that reports time to DOM
function reportTime(time, currentOrTotal, domId) {
time = new Date();
document.getElementById(domId).innerHTML += `<span class="bold">${time - currentOrTotal} ms</span>`;
currentTime = new Date();
}
function checkForMobile() {
testExp = new RegExp('Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile', 'i');
return testExp.test(navigator.userAgent) ? true : false;
}
function setServerImage(imageSource) {
document.querySelector(`[data-src='${imageSource}']`).setAttribute('src', `${imageSource}`); |
<<<<<<<
label="hollaex-modal"
=======
label="exir-modal"
className="app-dialog"
>>>>>>>
label="hollaex-modal"
className="app-dialog" |
<<<<<<<
evalFrameMessageQueue: {
type: 'array',
items: { type: 'string' },
},
evalFrameReady: { type: 'boolean' },
=======
userData: { type: 'object' },
>>>>>>>
userData: { type: 'object' },
evalFrameMessageQueue: {
type: 'array',
items: { type: 'string' },
},
evalFrameReady: { type: 'boolean' }, |
<<<<<<<
=======
//import Interpreter from 'js-interpreter'
>>>>>>>
<<<<<<<
var initialState = newBlankState();
=======
// var INTERPRETER = new Interpreter('')
// INTERPRETER.defaultProperties = Object.keys(INTERPRETER.global.properties)
// INTERPRETER.declaredProperties = ()=>{
// var out = {};
// var declaredProps = Object.keys(INTERPRETER.global.properties)
// .filter(x=> !new Set(INTERPRETER.defaultProperties).has(x))
// declaredProps.forEach((p)=>out[p]=INTERPRETER.global.properties[p])
// return out;
// };
function newBlankState() {
return {
title: undefined,
cells: [],
currentlySelected: undefined,
declaredProperties: {},
lastValue: undefined,
lastSaved: undefined,
mode: 'command',
history: [],
externalScripts: []
};
}
var initialState = newBlankState();
>>>>>>>
var initialState = newBlankState();
<<<<<<<
var rect = elem.getBoundingClientRect();
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
var tallerThanWindow = rect.bottom - rect.top > windowHeight;
var cellPosition;
// verbose but readable
if (rect.bottom <= 0) {
cellPosition = "ABOVE_VIEWPORT";
} else if (rect.top >= windowHeight) {
cellPosition = "BELOW_VIEWPORT";
} else if (rect.top <= 0 && 0 <= rect.bottom) {
cellPosition = "BOTTOM_IN_VIEWPORT";
} else if (rect.top <= windowHeight && windowHeight <= rect.bottom) {
cellPosition = "TOP_IN_VIEWPORT";
} else {
cellPosition = "IN_VIEWPORT";
};
if (cellPosition == "ABOVE_VIEWPORT" || cellPosition == "BOTTOM_IN_VIEWPORT" || cellPosition == "BELOW_VIEWPORT" && tallerThanWindow || cellPosition == "TOP_IN_VIEWPORT" && tallerThanWindow) {
// in these cases, scroll the window such that the cell top is at the window top
elem.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
} else if (cellPosition == "BELOW_VIEWPORT" && !tallerThanWindow || cellPosition == "TOP_IN_VIEWPORT" && !tallerThanWindow) {
//in these cases, scroll the window such that the cell bottom is at the window bottom
elem.scrollIntoView({
behavior: 'smooth',
block: 'end'
});
}
}
function addExternalScript(scriptUrl) {
// FIXME there must be a better way to do this with promises etc...
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = scriptUrl;
head.appendChild(script);
=======
var cellOutside = isCellOutsideViewport(elem);
console.log("cell outside viewport?", cellOutside);
if (cellOutside) {
elem.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}
function isCellOutsideViewport(el) {
var rect = el.getBoundingClientRect();
var windowBottom = window.innerHeight || document.documentElement.clientHeight;
if (rect.bottom <= 0) {
return "ABOVE_VIEWPORT";
} else if (rect.top >= windowBottom) {
return "BELOW_VIEWPORT";
} else if (rect.top <= 0 && 0 <= rect.bottom) {
return "BOTTOM_IN_VIEWPORT";
} else if (rect.top <= windowBottom && windowBottom <= rect.bottom) {
return "TOP_IN_VIEWPORT";
} else {
return false;
};
}
function addExternalScript(scriptUrl) {
// FIXME there must be a better way to do this with promises etc...
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = scriptUrl;
head.appendChild(script);
>>>>>>>
var rect = elem.getBoundingClientRect();
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
var tallerThanWindow = rect.bottom - rect.top > windowHeight;
var cellPosition;
// verbose but readable
if (rect.bottom <= 0) {
cellPosition = "ABOVE_VIEWPORT";
} else if (rect.top >= windowHeight) {
cellPosition = "BELOW_VIEWPORT";
} else if (rect.top <= 0 && 0 <= rect.bottom) {
cellPosition = "BOTTOM_IN_VIEWPORT";
} else if (rect.top <= windowHeight && windowHeight <= rect.bottom) {
cellPosition = "TOP_IN_VIEWPORT";
} else {
cellPosition = "IN_VIEWPORT";
};
if (cellPosition == "ABOVE_VIEWPORT" || cellPosition == "BOTTOM_IN_VIEWPORT" || cellPosition == "BELOW_VIEWPORT" && tallerThanWindow || cellPosition == "TOP_IN_VIEWPORT" && tallerThanWindow) {
// in these cases, scroll the window such that the cell top is at the window top
elem.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
} else if (cellPosition == "BELOW_VIEWPORT" && !tallerThanWindow || cellPosition == "TOP_IN_VIEWPORT" && !tallerThanWindow) {
//in these cases, scroll the window such that the cell bottom is at the window bottom
elem.scrollIntoView({
behavior: 'smooth',
block: 'end'
});
}
}
function addExternalScript(scriptUrl) {
// FIXME there must be a better way to do this with promises etc...
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = scriptUrl;
head.appendChild(script);
<<<<<<<
{ id: 'cell-' + this.props.cell.id,
className: 'cell-container',
onMouseEnter: this.showControls.bind(this),
onMouseLeave: this.hideControls.bind(this),
onMouseDown: this.selectCell },
=======
{ id: 'cell-' + this.props.cell.id,
className: 'cell-container ' + (this.props.display ? '' : 'hidden-cell'),
onMouseEnter: this.showControls.bind(this),
onMouseLeave: this.hideControls.bind(this),
onMouseDown: this.selectCell },
>>>>>>>
{ id: 'cell-' + this.props.cell.id,
className: 'cell-container ' + (this.props.display ? '' : 'hidden-cell'),
onMouseEnter: this.showControls.bind(this),
onMouseLeave: this.hideControls.bind(this),
onMouseDown: this.selectCell }, |
<<<<<<<
export function changeSidePaneMode(sidePaneMode) {
=======
export function increaseEditorWidth() {
return {
type: 'INCREASE_EDITOR_WIDTH',
}
}
export function decreaseEditorWidth() {
return {
type: 'DECREASE_EDITOR_WIDTH',
}
}
export function changeSidePaneMode(mode) {
>>>>>>>
export function increaseEditorWidth() {
return {
type: 'INCREASE_EDITOR_WIDTH',
}
}
export function decreaseEditorWidth() {
return {
type: 'DECREASE_EDITOR_WIDTH',
}
}
export function changeSidePaneMode(sidePaneMode) { |
<<<<<<<
let IODIDE_SESSION_ID = queryString.parse(window.location.search).sessionId
let { editorOrigin } = queryString.parse(window.location.search)
if (IODIDE_BUILD_MODE === 'test') {
IODIDE_SESSION_ID = 'testing-session'
editorOrigin = 'http://testing.origin'
}
const mc = new MessageChannel();
window.parent.postMessage(IODIDE_SESSION_ID, editorOrigin, [mc.port2]);
const portToEditor = mc.port1
export function postMessageToEditor(messageType, message) {
portToEditor.postMessage({ messageType, message })
}
export function postActionToEditor(actionObj) {
postMessageToEditor('REDUX_ACTION', actionObj)
}
export function postKeypressToEditor(keypressStr) {
postMessageToEditor('KEYPRESS', keypressStr)
}
=======
>>>>>>>
const mc = new MessageChannel();
window.parent.postMessage('EVAL_FRAME_READY_MESSAGE', IODIDE_EDITOR_ORIGIN, [mc.port2]);
const portToEditor = mc.port1
export function postMessageToEditor(messageType, message) {
portToEditor.postMessage({ messageType, message })
}
<<<<<<<
portToEditor.onmessage = receiveMessage
=======
const mc = new MessageChannel();
window.parent.postMessage('EVAL_FRAME_READY_MESSAGE', IODIDE_EDITOR_ORIGIN, [mc.port2]);
const portToEditor = mc.port1
portToEditor.onmessage = receiveMessage
export function postMessageToEditor(messageType, message) {
portToEditor.postMessage({ messageType, message })
}
export function postActionToEditor(actionObj) {
postMessageToEditor('REDUX_ACTION', actionObj)
}
export function postKeypressToEditor(keypressStr) {
postMessageToEditor('KEYPRESS', keypressStr)
}
>>>>>>>
portToEditor.onmessage = receiveMessage
export function postActionToEditor(actionObj) {
postMessageToEditor('REDUX_ACTION', actionObj)
}
export function postKeypressToEditor(keypressStr) {
postMessageToEditor('KEYPRESS', keypressStr)
} |
<<<<<<<
cells: [{
id: 5,
selected: true,
cellType: 'code',
},
],
mode: 'EDIT_MODE',
=======
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'edit',
>>>>>>>
mode: 'EDIT_MODE',
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
<<<<<<<
it('should return the basic info for the correct cell', () => {
const ownProps = { cellId: 5 }
expect(mapStateToProps(state, ownProps))
.toEqual({
cellId: 5,
selected: true,
editingCell: true,
cellType: 'code',
})
})
it('should return editingCell as false if selected===false and mode===edit', () => {
const ownProps = { cellId: 5 }
state.mode = 'EDIT_MODE'
state.cells[0].selected = false
expect(mapStateToProps(state, ownProps))
.toEqual({
cellId: 5,
selected: false,
editingCell: false,
cellType: 'code',
})
})
it('should return editingCell as false if selected===true and mode===not_edit', () => {
const ownProps = { cellId: 5 }
state.mode = 'not_edit'
state.cells[0].selected = true
expect(mapStateToProps(state, ownProps))
.toEqual({
cellId: 5,
selected: true,
editingCell: false,
cellType: 'code',
})
})
it('should return editingCell as false if selected===false and mode===not_edit', () => {
const ownProps = { cellId: 5 }
state.mode = 'not_edit'
state.cells[0].selected = false
expect(mapStateToProps(state, ownProps))
.toEqual({
cellId: 5,
selected: false,
editingCell: false,
cellType: 'code',
})
=======
const stateToContainerStylesMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: 'solid #bbb 1px' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: 'solid #f1f1f1 1px' },
},
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: 'solid #bbb 2px' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: 'solid #f1f1f1 1px' },
},
]
stateToContainerStylesMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).cellContainerStyle)
.toEqual(testCase.style)
})
})
const stateToMainComponentOutlineMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: '1px solid #bbb' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: '1px solid #f1f1f1' },
},
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: '1px solid #f1f1f1' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: '1px solid #f1f1f1' },
},
]
stateToMainComponentOutlineMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).mainComponentStyle.outline)
.toEqual(testCase.style.outline)
})
})
const stateToMainComponentDisplayMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'HIDDEN' }],
mode: 'edit',
},
style: { display: 'none' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'ANYTHING_NOT_HIDDED' }],
mode: 'edit',
},
style: { display: 'block' },
},
]
stateToMainComponentDisplayMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).mainComponentStyle.display)
.toEqual(testCase.style.display)
})
})
it('mainComponentClass correctly passes through inputFolding', () => {
state.cells[0].inputFolding = 'TEST_STRING'
expect(mapStateToProps(state, ownProps).mainComponentClass)
.toEqual('main-component TEST_STRING')
})
it('mainComponentClass correctly passes through inputFolding', () => {
expect(mapStateToProps(state, ownProps).mainComponentClass)
.toEqual('main-component VISIBLE')
})
it('correctly passes through nextInputFolding', () => {
state.cells[0].inputFolding = 'HIDDEN'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('VISIBLE')
state.cells[0].inputFolding = 'VISIBLE'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('SCROLL')
state.cells[0].inputFolding = 'SCROLL'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('HIDDEN')
>>>>>>>
const stateToContainerStylesMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: 'solid #bbb 1px' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: 'solid #f1f1f1 1px' },
},
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: 'solid #bbb 2px' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: 'solid #f1f1f1 1px' },
},
]
stateToContainerStylesMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).cellContainerStyle)
.toEqual(testCase.style)
})
})
const stateToMainComponentOutlineMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: '1px solid #bbb' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'edit',
},
style: { outline: '1px solid #f1f1f1' },
},
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: '1px solid #f1f1f1' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'VISIBLE' }],
mode: 'command',
},
style: { outline: '1px solid #f1f1f1' },
},
]
stateToMainComponentOutlineMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).mainComponentStyle.outline)
.toEqual(testCase.style.outline)
})
})
const stateToMainComponentDisplayMappings = [
{
state: {
cells: [{ id: 5, selected: true, inputFolding: 'HIDDEN' }],
mode: 'edit',
},
style: { display: 'none' },
},
{
state: {
cells: [{ id: 5, selected: false, inputFolding: 'ANYTHING_NOT_HIDDED' }],
mode: 'edit',
},
style: { display: 'block' },
},
]
stateToMainComponentDisplayMappings.forEach((testCase, i) => {
it(`cell container should get correct styles, case index ${i}`, () => {
expect(mapStateToProps(testCase.state, ownProps).mainComponentStyle.display)
.toEqual(testCase.style.display)
})
})
it('mainComponentClass correctly passes through inputFolding', () => {
state.cells[0].inputFolding = 'TEST_STRING'
expect(mapStateToProps(state, ownProps).mainComponentClass)
.toEqual('main-component TEST_STRING')
})
it('mainComponentClass correctly passes through inputFolding', () => {
expect(mapStateToProps(state, ownProps).mainComponentClass)
.toEqual('main-component VISIBLE')
})
it('correctly passes through nextInputFolding', () => {
state.cells[0].inputFolding = 'HIDDEN'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('VISIBLE')
state.cells[0].inputFolding = 'VISIBLE'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('SCROLL')
state.cells[0].inputFolding = 'SCROLL'
expect(mapStateToProps(state, ownProps).nextInputFolding)
.toEqual('HIDDEN') |
<<<<<<<
const { remote, webFrame, shell, clipboard } = require('electron');
const { MenuItem, dialog } = remote;
=======
const { clipboard, remote, shell, webFrame } = require('electron');
>>>>>>>
const { clipboard, remote, shell, webFrame } = require('electron');
const { MenuItem, dialog } = remote; |
<<<<<<<
* $.after("minute", function() { ... }); // 1 minute
=======
* $.after("1 hour, 2 minutes, 15 seconds", function() { ... }); // 1:02:15 hours
* $.after("1min, 15 s", function() { ... }); // 1:15 minutes
>>>>>>>
* $.after("minute", function() { ... }); // 1 minute
* $.after("1 hour, 2 minutes, 15 seconds", function() { ... }); // 1:02:15 hours
* $.after("1min, 15 s", function() { ... }); // 1:15 minutes |
<<<<<<<
=======
RunListHelper.getServiceConfigFromGithub(bosco, boscoService.name, function(err, svcConfig) {
if (err || !svcConfig) {
missingDependencies.push(boscoService.name);
return next();
}
if (!svcConfig.service || !svcConfig.service.type || svcConfig.service.type !== 'docker') {
var psuedoServiceConfig = RunListHelper.getServiceDockerConfig(boscoService, svcConfig);
if (psuedoServiceConfig) {
svcConfig.service = psuedoServiceConfig;
} else {
missingDependencies.push(boscoService.name);
return next();
}
}
if (!svcConfig.name) svcConfig.name = boscoService.name;
stopService(repo, svcConfig, runningServices, next);
});
>>>>>>> |
<<<<<<<
describe('Plotly.supplyDefaults', function() {
function testSanitizeMarginsHasBeenCalledOnlyOnce(gd) {
spyOn(Plots, 'sanitizeMargins').and.callThrough();
Plots.supplyDefaults(gd);
expect(Plots.sanitizeMargins).toHaveBeenCalledTimes(1);
}
it('should not throw an error when gd is a plain object', function() {
var height = 100,
gd = {
layout: {
height: height
}
};
Plots.supplyDefaults(gd);
expect(gd.layout.height).toBe(height);
expect(gd._fullLayout).toBeDefined();
expect(gd._fullLayout.height).toBe(height);
expect(gd._fullLayout.width).toBe(Plots.layoutAttributes.width.dflt);
expect(gd._fullData).toBeDefined();
});
it('should call sanitizeMargins only once when both width and height are defined', function() {
var gd = {
layout: {
width: 100,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
it('should call sanitizeMargins only once when autosize is false', function() {
var gd = {
layout: {
autosize: false,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
it('should call sanitizeMargins only once when autosize is true', function() {
var gd = {
layout: {
autosize: true,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
});
=======
describe('Plots.supplyDefaults', function() {
var gd;
it('should relink private keys', function() {
var oldFullData = [{
type: 'scatter3d',
z: [1, 2, 3]
}, {
type: 'contour',
_empties: [1, 2, 3]
}];
var oldFullLayout = {
_plots: { xy: { plot: {} } },
xaxis: { c2p: function() {} },
yaxis: { _m: 20 },
scene: { _scene: {} },
annotations: [{ _min: 10, }, { _max: 20 }],
someFunc: function() {}
};
var newData = [{
type: 'scatter3d',
z: [1, 2, 3, 4]
}, {
type: 'contour',
z: [[1, 2, 3], [2, 3, 4]]
}];
var newLayout = {
annotations: [{}, {}, {}]
};
gd = {
_fullData: oldFullData,
_fullLayout: oldFullLayout,
data: newData,
layout: newLayout
};
Plots.supplyDefaults(gd);
expect(gd._fullData[0].z).toBe(newData[0].z);
expect(gd._fullData[1].z).toBe(newData[1].z);
expect(gd._fullData[1]._empties).toBe(oldFullData[1]._empties);
expect(gd._fullLayout.scene._scene).toBe(oldFullLayout.scene._scene);
expect(gd._fullLayout._plots.plot).toBe(oldFullLayout._plots.plot);
expect(gd._fullLayout.annotations[0]._min).toBe(oldFullLayout.annotations[0]._min);
expect(gd._fullLayout.annotations[1]._max).toBe(oldFullLayout.annotations[1]._max);
expect(gd._fullLayout.someFunc).toBe(oldFullLayout.someFunc);
expect(gd._fullLayout.xaxis.c2p)
.not.toBe(oldFullLayout.xaxis.c2p, '(set during ax.setScale');
expect(gd._fullLayout.yaxis._m)
.not.toBe(oldFullLayout.yaxis._m, '(set during ax.setScale');
});
});
>>>>>>>
describe('Plots.supplyDefaults', function() {
it('should not throw an error when gd is a plain object', function() {
var height = 100,
gd = {
layout: {
height: height
}
};
Plots.supplyDefaults(gd);
expect(gd.layout.height).toBe(height);
expect(gd._fullLayout).toBeDefined();
expect(gd._fullLayout.height).toBe(height);
expect(gd._fullLayout.width).toBe(Plots.layoutAttributes.width.dflt);
expect(gd._fullData).toBeDefined();
});
it('should relink private keys', function() {
var oldFullData = [{
type: 'scatter3d',
z: [1, 2, 3]
}, {
type: 'contour',
_empties: [1, 2, 3]
}];
var oldFullLayout = {
_plots: { xy: { plot: {} } },
xaxis: { c2p: function() {} },
yaxis: { _m: 20 },
scene: { _scene: {} },
annotations: [{ _min: 10, }, { _max: 20 }],
someFunc: function() {}
};
var newData = [{
type: 'scatter3d',
z: [1, 2, 3, 4]
}, {
type: 'contour',
z: [[1, 2, 3], [2, 3, 4]]
}];
var newLayout = {
annotations: [{}, {}, {}]
};
var gd = {
_fullData: oldFullData,
_fullLayout: oldFullLayout,
data: newData,
layout: newLayout
};
Plots.supplyDefaults(gd);
expect(gd._fullData[0].z).toBe(newData[0].z);
expect(gd._fullData[1].z).toBe(newData[1].z);
expect(gd._fullData[1]._empties).toBe(oldFullData[1]._empties);
expect(gd._fullLayout.scene._scene).toBe(oldFullLayout.scene._scene);
expect(gd._fullLayout._plots.plot).toBe(oldFullLayout._plots.plot);
expect(gd._fullLayout.annotations[0]._min).toBe(oldFullLayout.annotations[0]._min);
expect(gd._fullLayout.annotations[1]._max).toBe(oldFullLayout.annotations[1]._max);
expect(gd._fullLayout.someFunc).toBe(oldFullLayout.someFunc);
expect(gd._fullLayout.xaxis.c2p)
.not.toBe(oldFullLayout.xaxis.c2p, '(set during ax.setScale');
expect(gd._fullLayout.yaxis._m)
.not.toBe(oldFullLayout.yaxis._m, '(set during ax.setScale');
});
function testSanitizeMarginsHasBeenCalledOnlyOnce(gd) {
spyOn(Plots, 'sanitizeMargins').and.callThrough();
Plots.supplyDefaults(gd);
expect(Plots.sanitizeMargins).toHaveBeenCalledTimes(1);
}
it('should call sanitizeMargins only once when both width and height are defined', function() {
var gd = {
layout: {
width: 100,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
it('should call sanitizeMargins only once when autosize is false', function() {
var gd = {
layout: {
autosize: false,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
it('should call sanitizeMargins only once when autosize is true', function() {
var gd = {
layout: {
autosize: true,
height: 100
}
};
testSanitizeMarginsHasBeenCalledOnlyOnce(gd);
});
}); |
<<<<<<<
'_ev', 'on', 'once', 'removeListener', 'removeAllListeners',
'emit', '_context', '_replotPending',
'_hmpixcount', '_hmlumcount', '_mouseDownTime'
=======
'_ev', '_internalEv', 'on', 'once', 'removeListener', 'removeAllListeners',
'_internalOn', '_internalOnce', '_removeInternalListener',
'_removeAllInternalListeners', 'emit', '_context', '_replotPending',
'_mouseDownTime', '_hmpixcount', '_hmlumcount'
>>>>>>>
'_ev', '_internalEv', 'on', 'once', 'removeListener', 'removeAllListeners',
'_internalOn', '_internalOnce', '_removeInternalListener',
'_removeAllInternalListeners', 'emit', '_context', '_replotPending',
'_hmpixcount', '_hmlumcount', '_mouseDownTime' |
<<<<<<<
else if(gd._context.showBrand) positionBrand(gd,toolspan);
=======
else if(!gd.mainsite && !gd.standalone &&
!$('#plotlyUserProfileMarker').length) {
positionPlayWithData(gd,toolspan);
}
>>>>>>>
if(gd._context.showBrand) positionPlayWithData(gd,toolspan);
<<<<<<<
function positionBrand(gd,container){
=======
// note that now this function is only adding the brand in
// iframes and 3rd-party apps, standalone plots get the sidebar instead.
function positionPlayWithData(gd,container){
>>>>>>>
// note that now this function is only adding the brand in
// iframes and 3rd-party apps, standalone plots get the sidebar instead.
function positionPlayWithData(gd,container){
<<<<<<<
// Polar plots
// Check if it has a polar type
if(data && data[0] && data[0].type &&
data[0].type.indexOf('Polar') !== -1){
console.log('This polar chart uses a deprecated pre-release API');
return null;
}
if(data && data[0] && data[0].r){
// build or reuse the container skeleton
var plotContainer = d3.select(gd).selectAll('.plot-container')
.data([0]);
plotContainer.enter()
.insert('div', ':first-child')
.classed('plot-container plotly', true);
var paperDiv = plotContainer.selectAll('.svg-container')
.data([0]);
paperDiv.enter().append('div')
.classed('svg-container',true)
.style('position','relative');
// empty it everytime for now
paperDiv.html('');
// fulfill gd requirements
if(data) gd.data = data;
gd.layout = layout;
gd.layout._container = plotContainer;
gd.layout._paperdiv = paperDiv;
if(gd.layout.autosize === 'initial' && gd._context.autosizable) {
plotAutoSize(gd, {});
gd.layout.autosize = true;
}
// resize canvas
paperDiv.style({
width: (layout.width || 800) + 'px',
height: (layout.height || 600) + 'px',
background: (layout.paper_bgcolor || 'white')
});
// instantiate framework
gd.framework = micropolar.manager.framework();
//get rid of gd.layout stashed nodes
layout = µ.util.deepExtend({}, gd.layout);
delete layout._container;
delete layout._paperdiv;
delete layout.autosize;
delete layout._paper;
// plot
gd.framework({data: gd.data, layout: layout}, paperDiv.node());
// set undo point
gd.framework.setUndoPoint();
// get the resulting svg for extending it
var polarPlotSVG = gd.framework.svg();
// editable title
var opacity = 1;
var txt = gd.layout.title;
if(txt === '' || !txt) opacity = 0;
var placeholderText = 'Click to enter title';
var titleLayout = function(){
this.call(Plotly.util.convertToTspans);
//TODO: html/mathjax
//TODO: center title
};
var title = polarPlotSVG.select('.title-group text')
.call(titleLayout);
if(gd._context.editable){
title.attr({'data-unformatted': txt});
if(!txt || txt === placeholderText){
opacity = 0.2;
title.attr({'data-unformatted': placeholderText})
.text(placeholderText)
.style({opacity: opacity})
.on('mouseover.opacity',function(){
d3.select(this).transition().duration(100)
.style('opacity',1);
})
.on('mouseout.opacity',function(){
d3.select(this).transition().duration(1000)
.style('opacity',0);
});
}
var setContenteditable = function(){
this.call(Plotly.util.makeEditable)
.on('edit', function(text){
gd.framework({layout: {title: text}});
this.attr({'data-unformatted': text})
.text(text)
.call(titleLayout);
this.call(setContenteditable);
})
.on('cancel', function(){
var txt = this.attr('data-unformatted');
this.text(txt).call(titleLayout);
});
};
title.call(setContenteditable);
gd.layout._paperdiv = paperDiv;
Plotly.ToolPanel.tweakMenu();
}
=======
if(!gd.layout || graphwasempty) gd.layout = cleanLayout(layout);
>>>>>>>
if(!gd.layout || graphwasempty) gd.layout = cleanLayout(layout);
<<<<<<<
else if(gd._context.editable) Plotly.ToolPanel.tweakMenu();
=======
if(gd.mainsite) Plotly.ToolPanel.tweakMenu();
>>>>>>>
if(gd._context.editable) Plotly.ToolPanel.tweakMenu();
<<<<<<<
if(recalc) {
gd.calcdata = [];
gd._modules = [];
if(!gd.data) { gd.data = []; }
// extra helper variables
// firstscatter: fill-to-next on the first trace goes to zero
gd.firstscatter = true;
// how many box plots do we have (in case they're grouped)
gd.numboxes = 0;
// for calculating avg luminosity of heatmaps
gd._hmpixcount = 0;
gd._hmlumcount = 0;
// delete category list, if there is one, so we start over
// to be filled in later by ax.d2c
Plotly.Axes.list(gd).forEach(function(ax){ ax._categories = []; });
for(var curve = 0; curve<gd.data.length; curve++) {
// curve is the index, gdc is the data object for one trace
var gdc = gd.data[curve],
module = '',
cd = [];
// fill in default curve type
if(!gdc.type) { gdc.type = 'scatter'; }
// if no name is given, make a default from the curve number
if(!gdc.name) {
if(gdc.ysrc) {
var ns = gdc.ysrc.split('/');
gdc.name = ns[ns.length-1].replace(/\n/g,' ');
}
else { gdc.name = 'trace '+curve; }
}
// figure out which module plots this data
if('r' in gdc) {
console.log('Oops, tried to put a polar trace of type ' +
gdc.type + ' on an incompatible graph of cartesian ' +
gd.data[0].type + ' data. Ignoring this dataset.'
);
}
// styling change
// see https://github.com/plotly/Contributors-Guide/blob/master/styleguides/javascript.md#blocks
else if(plots.isScatter(gdc.type)) module = 'Scatter';
else if(plots.isBar(gdc.type)) module = 'Bars';
else if(plots.isContour(gdc.type)) module = 'Contour';
else if(plots.isHeatmap(gdc.type)) module = 'Heatmap';
else if(gdc.type==='box') module = 'Boxes';
else {
console.log('Unrecognized plot type ' + gdc.type +
'. Ignoring this dataset.'
);
}
if(module) { cd = Plotly[module].calc(gd,gdc); }
if(!('line' in gdc)) { gdc.line = {}; }
if(!('marker' in gdc)) { gdc.marker = {}; }
if(!('line' in gdc.marker)) { gdc.marker.line = {}; }
if(!('textfont' in gdc)) { gdc.textfont = {}; }
// make sure there is a first point
// this ensures there is a calcdata item for every trace,
// even if cartesian logic doesn't handle it
if(!$.isArray(cd) || !cd[0]) { cd = [{x: false, y: false}]; }
// add the trace-wide properties to the first point,
// per point properties to every point
// t is the holder for trace-wide properties
if(!cd[0].t) { cd[0].t = {}; }
// store the gd.data curve number that gave this trace
cd[0].t.curve = curve;
// store the calcdata curve number we're in - should be the same
cd[0].t.cdcurve = gd.calcdata.length;
if(module) {
// store the module for this trace, for use later to plot
cd[0].t.module = module;
// save which modules we're using
if(gd._modules.indexOf(module)===-1) {
gd._modules.push(module);
}
}
gd.calcdata.push(cd);
Plotly.Lib.markTime('done with calcdata for '+curve);
}
}
=======
if(recalc) doCalcdata(gd);
>>>>>>>
if(recalc) doCalcdata(gd);
<<<<<<<
if(!gd || !gd._context || !gd._context.workspace ||
!gd.layout || gd.tabtype!=='plot' ||
=======
if(!gd || !gd.mainsite || !gd._fullLayout || gd.tabtype!=='plot' ||
>>>>>>>
if(!gd || !gd._context || !gd._context.workspace ||
!gd._fullLayout || gd.tabtype!=='plot' ||
<<<<<<<
var newheight, newwidth;
if(gd._context.workspace){
=======
var fullLayout = gd._fullLayout,
newheight,
newwidth;
if(gd.mainsite){
>>>>>>>
var fullLayout = gd._fullLayout,
newheight,
newwidth;
if(gd._context.workspace){
<<<<<<<
function makePlotFramework(gd, layout) {
if(typeof gd === 'string') { gd = document.getElementById(gd); }
var gd3 = d3.select(gd);
setPlotContext(gd);
gd._promises = [];
// hook class for plots main container (in case of plotly.js
// this won't be #embedded-graph or .js-tab-contents)
gd3.classed('js-plotly-plot',true);
makeTester(gd);
function addDefaultAxis(container, axname) {
if(!container[axname]) {
container[axname] = Plotly.Axes.defaultAxis({
range: [-1,6],
anchor: {x:'y',y:'x'}[axname.charAt(0)]
});
}
}
// Get the layout info - take the default or any existing layout,
// then update with layout arg
var oldLayout = gd.layout || defaultLayout(),
newLayout = layout || {};
// look for axes to include in oldLayout
// so that default axis settings get included
var xalist = Object.keys(newLayout)
.filter(function(k){ return k.match(/^xaxis[0-9]*$/); }),
yalist = Object.keys(newLayout)
.filter(function(k){ return k.match(/^yaxis[0-9]*$/); }),
// temp hack for webgl
type = (type = gd.data) && (type = type[0]) && (type = type.type),
gl = gd.layout,
subplots;
if(!xalist.length) { xalist = ['xaxis']; }
if(!yalist.length) { yalist = ['yaxis']; }
xalist.concat(yalist).forEach(function(axname) {
addDefaultAxis(oldLayout,axname);
// if an axis range was explicitly provided with newlayout,
// turn off autorange
var ax = newLayout[axname];
if(ax && ax.range && ax.range.length===2) {
oldLayout[axname].autorange = false;
}
});
gd.layout = gl = updateObject(oldLayout, newLayout);
var doCartesian = gl._hasCartesian || !gl._hasGL3D;
if (doCartesian) {
// do a bunch of 2D axis stuff
// Get subplots and see if we need to make any more axes
=======
function makePlotFramework(gd) {
var gd3 = d3.select(gd),
subplots,
fullLayout = gd._fullLayout;
// TODO: now that we're never calling this on its own, can we do it
// without initializing and drawing axes, just making containers?
if (fullLayout._hasCartesian && !fullLayout._hasGL3D) {
>>>>>>>
function makePlotFramework(gd) {
var gd3 = d3.select(gd),
subplots,
fullLayout = gd._fullLayout;
// TODO: now that we're never calling this on its own, can we do it
// without initializing and drawing axes, just making containers?
if (fullLayout._hasCartesian && !fullLayout._hasGL3D) {
<<<<<<<
if(gl.autosize === 'initial') {
if(gd._context.workspace) setFileAndCommentsSize(gd);
=======
if(fullLayout.autosize === 'initial') {
if(gd.mainsite) setFileAndCommentsSize(gd);
>>>>>>>
if(fullLayout.autosize === 'initial') {
if(gd._context.workspace) setFileAndCommentsSize(gd);
<<<<<<<
gl._paperdiv.selectAll('svg').remove();
gl._paper = gl._paperdiv.append('svg')
=======
fullLayout._paperdiv.selectAll('svg').remove();
fullLayout._paper = fullLayout._paperdiv.append('svg')
>>>>>>>
fullLayout._paperdiv.selectAll('svg').remove();
fullLayout._paper = fullLayout._paperdiv.append('svg')
<<<<<<<
if(gd._context.editable){
if(!txt) { setPlaceholder(); }
=======
// don't allow editing (or placeholder) on embedded graphs or exports
if(gd.mainsite && !gd.forexport){
if(!txt) setPlaceholder();
>>>>>>>
if(gd._context.editable){
if(!txt) setPlaceholder(); |
<<<<<<<
annotation: options._input,
fullAnnotation: options
=======
annotation: optionsIn,
fullAnnotation: options,
event: d3.event
>>>>>>>
annotation: options._input,
fullAnnotation: options,
event: d3.event |
<<<<<<<
var DASH_PATTERNS = require('../../constants/gl3d_dashes');
var MARKER_SYMBOLS = require('../../constants/gl_markers');
=======
var Scatter = require('../scatter');
var DASH_PATTERNS = require('../../constants/gl3d_dashes.json');
var MARKER_SYMBOLS = require('../../constants/gl_markers.json');
>>>>>>>
var DASH_PATTERNS = require('../../constants/gl3d_dashes');
var MARKER_SYMBOLS = require('../../constants/gl_markers');
var Scatter = require('../scatter'); |
<<<<<<<
function clickOrDoubleClick(gd, legend, clickedTrace, numClicks, evt) {
var datum = clickedTrace.data()[0][0];
var evtData = {
event: evt,
node: clickedTrace.node(),
itemNumber: datum.i,
curveNumber: datum.trace.index,
data: gd.data,
layout: gd.layout,
frames: gd._transitionData._frames,
config: gd._context,
fullData: gd._fullData,
fullLayout: gd._fullLayout
};
var returnVal;
if(numClicks === 1) {
legend._clickTimeout = setTimeout(function() {
returnVal = Events.triggerHandler(gd, 'plotly_legendclick', evtData);
if(returnVal !== false) handleClick(clickedTrace, gd, numClicks);
}, DBLCLICKDELAY);
}
else if(numClicks === 2) {
if(legend._clickTimeout) clearTimeout(legend._clickTimeout);
gd._legendMouseDownTime = 0;
returnVal = Events.triggerHandler(gd, 'plotly_legenddoubleclick', evtData);
if(returnVal !== false) handleClick(clickedTrace, gd, numClicks);
}
}
function drawTexts(g, gd) {
var legendItem = g.data()[0][0],
fullLayout = gd._fullLayout,
trace = legendItem.trace,
isPie = Registry.traceIs(trace, 'pie'),
traceIndex = trace.index,
name = isPie ? legendItem.label : trace.name;
=======
function drawTexts(g, gd, maxLength) {
var legendItem = g.data()[0][0];
var fullLayout = gd._fullLayout;
var trace = legendItem.trace;
var isPie = Registry.traceIs(trace, 'pie');
var traceIndex = trace.index;
var name = isPie ? legendItem.label : trace.name;
var isEditable = gd._context.edits.legendText && !isPie;
>>>>>>>
function clickOrDoubleClick(gd, legend, clickedTrace, numClicks, evt) {
var datum = clickedTrace.data()[0][0];
var evtData = {
event: evt,
node: clickedTrace.node(),
itemNumber: datum.i,
curveNumber: datum.trace.index,
data: gd.data,
layout: gd.layout,
frames: gd._transitionData._frames,
config: gd._context,
fullData: gd._fullData,
fullLayout: gd._fullLayout
};
var returnVal;
if(numClicks === 1) {
legend._clickTimeout = setTimeout(function() {
returnVal = Events.triggerHandler(gd, 'plotly_legendclick', evtData);
if(returnVal !== false) handleClick(clickedTrace, gd, numClicks);
}, DBLCLICKDELAY);
}
else if(numClicks === 2) {
if(legend._clickTimeout) clearTimeout(legend._clickTimeout);
gd._legendMouseDownTime = 0;
returnVal = Events.triggerHandler(gd, 'plotly_legenddoubleclick', evtData);
if(returnVal !== false) handleClick(clickedTrace, gd, numClicks);
}
}
function drawTexts(g, gd, maxLength) {
var legendItem = g.data()[0][0];
var fullLayout = gd._fullLayout;
var trace = legendItem.trace;
var isPie = Registry.traceIs(trace, 'pie');
var traceIndex = trace.index;
var name = isPie ? legendItem.label : trace.name;
var isEditable = gd._context.edits.legendText && !isPie; |
<<<<<<<
// user dragging the legend
// if x/yanchor is 'auto':
// aligns left/right/center on resize or new text if drag pos
// is in left 1/3, middle 1/3, right 1/3
// similar logic for top/middle/bottom
if(td._context.editable) {
=======
if(td.mainsite) {
>>>>>>>
if(td._context.editable) { |
<<<<<<<
if (scatter) scatter.update(params);
else {
params.pickId0 = (scene.objectCount++)%256;
params.pickId1 = (scene.objectCount++)%256;
params.pickId2 = (scene.objectCount++)%256;
params.pickId3 = (scene.objectCount++)%256;
=======
if (scatter) {
/*
* We already have drawn this surface,
* lets just update it with the latest params
*/
scatter.update(params);
} else {
/*
* Push it onto the render queue
*/
var pickIds = scene.allocIds(4)
params.pickId0 = pickIds.ids[0];
params.pickId1 = pickIds.ids[1];
params.pickId2 = pickIds.ids[2];
params.pickId3 = pickIds.ids[3];
>>>>>>>
if (scatter) scatter.update(params);
else {
var pickIds = scene.allocIds(4)
params.pickId0 = pickIds.ids[0];
params.pickId1 = pickIds.ids[1];
params.pickId2 = pickIds.ids[2];
params.pickId3 = pickIds.ids[3]; |
<<<<<<<
/*
* isEmpty
* @UTILITY
* check if object is empty and all arrays strings and objects within are empty
*/
lib.isEmpty = function (obj) {
/*
* Checks for empty arrays,
* objects and empty strings
* and objects and arrays that
* only contain empty arrays, objects
* and strings and so on.
*/
var keys, bools;
if (obj === null) { return true; }
if (typeof(obj) === 'object' ) {
keys = Object.keys(obj);
}
else if (typeof(obj) === 'string') {
return obj.length === 0;
}
else if ((obj === 0) || obj) { return false; }
else { return true; } // its undefined or null so its empty
if (keys.length === 0) {
return true;
}
else {
bools = keys.map( function(key) {
return lib.isEmpty(obj[key]);
});
}
/*
* now go through array and see if any are not empty
* if so it returns true, but we negate it to return
* false ie some contents are not empty.
*/
return !bools.some(function(c) { return !c; });
}
=======
lib.getSources = function(td,container) {
var fid = lib.fullFid(td.fid);
var extrarefs = (td.ref_fids||[]).join(',');
if(!fid && !extrarefs) { return; }
$.post('/getsources', {fid:fid, extrarefs:extrarefs}, function(res) {
td.sourcelist = JSON.parse(res);
lib.showSources(td,container);
});
};
// fullfid - include the username in fid whether it was there or not
// also strip out backslash if one was there for selectability
// and turn tree roots into -1
lib.fullFid = function(fid) {
if (typeof fid =='number') { fid = String(fid); }
if (typeof fid !=='string' || fid==='') { return ''; }
if (fid.substr(fid.length-4)=='tree') { return '-1'; }
return ($.isNumeric(fid) && window.user ? (window.user+':'+fid) : fid).replace('\\:',':');
};
lib.showSources = function(td,container) {
// show the sources of data in the active tab
// Initially, for plots you have to set td.layout.showsources=true to enable this,
// then redraw the plot (like double click in it to autorange) to make it happen
// once we're happy with it we'll make it opt-out
var allsources = td.sourcelist;
if(!allsources) {
lib.getSources(td,container);
return;
}
$(td).find('.js-sourcelinks').text('');
var extsources = allsources.filter(function(v){return $.isNumeric(v.ref_fid); });
var firstsource = extsources[0] || allsources[0];
if(!firstsource) { return; }
// find number of unique internal and external sources
var extobj = {}, plotlyobj = {};
extsources.forEach(function(v){ extobj[v.url] = 1; });
allsources.forEach(function(v){ if(!$.isNumeric(v.ref_fid)){ plotlyobj[v.ref_fid] = 1; } });
var extcount = Object.keys(extobj).length,
plotlycount = Object.keys(plotlyobj).length;
if($(td).hasClass('js-plotly-plot')) {
if(td.layout.showsources) {
container.append('tspan').text('Source: ');
// Plotly.Drawing.font(container,f.family,f.size,f.color);
var mainlink = container.append('a').text(firstsource.ref_filename);
if($.isNumeric(firstsource.ref_fid)) {
mainlink.attr({'xlink:xlink:show':'new','xlink:xlink:href':firstsource.ref_url});
}
else if(td.mainsite) {
mainlink.attr({'xlink:xlink:href':'#'})
.on('click',function(){ pullf({fid:firstsource.ref_fid}); });
}
else {
var fidparts = firstsource.ref_fid.split(':');
mainlink.attr({'xlink:xlink:show':'new','xlink:xlink:href':'/'+fidparts[1]+'/~'+fidparts[0]});
}
if(allsources.length>1 && td.mainsite) {
container.append('tspan').text(' - ');
var extraslink = container.append('a').text('Full List')
.attr({'xlink:xlink:href':'#'})
.on('click',function(){ fullSourcing(); return false; });
}
}
}
else {
// TODO for grids or scripts - show sourcing in the menu bar?
}
function makeSourceObj(container, ref_by_uid) {
if(cnt<0) { console.log('infinite loop?'); return container; }
cnt--;
allsources.forEach(function(src){
if(src.ref_by_uid==ref_by_uid) {
var linkval;
if($.isNumeric(src.ref_fid)) {
linkval = '<a href="'+src.ref_url+'" target="_blank">'+src.ref_filename+'</a>'; // TODO: service name
}
else {
var ref_user = src.ref_fid.split(':')[0],
fn = (ref_user!=window.user ? ref_user+': ' : '') + src.ref_filename;
linkval = '<a href="#" data-fid="'+src.ref_fid+'">'+fn+'</a>';
}
container[linkval] = makeSourceObj({},src.uid);
}
});
return container;
}
var cnt = allsources.length,
sourceObj = makeSourceObj({}, null);
function fullSourcing(){
var sourceModal = $('#sourceModal');
var sourceViewer = sourceModal.find('#source-viewer').empty();
sourceViewer.data('jsontree', '').jsontree(JSON.stringify(sourceObj),{terminators:false, collapsibleOuter:false}).show();
sourceModal.find('[data-fid]').click(function(){
sourceModal.modal('hide');
pullf({fid:$(this).attr('data-fid')});
return false;
});
sourceModal.modal('show');
sourceModal.find('.close').off('click').on('click', function(d, i){
sourceModal.modal('hide');
return false;
});
}
};
>>>>>>>
lib.getSources = function(td,container) {
var fid = lib.fullFid(td.fid);
var extrarefs = (td.ref_fids||[]).join(',');
if(!fid && !extrarefs) { return; }
$.post('/getsources', {fid:fid, extrarefs:extrarefs}, function(res) {
td.sourcelist = JSON.parse(res);
lib.showSources(td,container);
});
};
// fullfid - include the username in fid whether it was there or not
// also strip out backslash if one was there for selectability
// and turn tree roots into -1
lib.fullFid = function(fid) {
if (typeof fid =='number') { fid = String(fid); }
if (typeof fid !=='string' || fid==='') { return ''; }
if (fid.substr(fid.length-4)=='tree') { return '-1'; }
return ($.isNumeric(fid) && window.user ? (window.user+':'+fid) : fid).replace('\\:',':');
};
lib.showSources = function(td,container) {
// show the sources of data in the active tab
// Initially, for plots you have to set td.layout.showsources=true to enable this,
// then redraw the plot (like double click in it to autorange) to make it happen
// once we're happy with it we'll make it opt-out
var allsources = td.sourcelist;
if(!allsources) {
lib.getSources(td,container);
return;
}
$(td).find('.js-sourcelinks').text('');
var extsources = allsources.filter(function(v){return $.isNumeric(v.ref_fid); });
var firstsource = extsources[0] || allsources[0];
if(!firstsource) { return; }
// find number of unique internal and external sources
var extobj = {}, plotlyobj = {};
extsources.forEach(function(v){ extobj[v.url] = 1; });
allsources.forEach(function(v){ if(!$.isNumeric(v.ref_fid)){ plotlyobj[v.ref_fid] = 1; } });
var extcount = Object.keys(extobj).length,
plotlycount = Object.keys(plotlyobj).length;
if($(td).hasClass('js-plotly-plot')) {
if(td.layout.showsources) {
container.append('tspan').text('Source: ');
// Plotly.Drawing.font(container,f.family,f.size,f.color);
var mainlink = container.append('a').text(firstsource.ref_filename);
if($.isNumeric(firstsource.ref_fid)) {
mainlink.attr({'xlink:xlink:show':'new','xlink:xlink:href':firstsource.ref_url});
}
else if(td.mainsite) {
mainlink.attr({'xlink:xlink:href':'#'})
.on('click',function(){ pullf({fid:firstsource.ref_fid}); });
}
else {
var fidparts = firstsource.ref_fid.split(':');
mainlink.attr({'xlink:xlink:show':'new','xlink:xlink:href':'/'+fidparts[1]+'/~'+fidparts[0]});
}
if(allsources.length>1 && td.mainsite) {
container.append('tspan').text(' - ');
var extraslink = container.append('a').text('Full List')
.attr({'xlink:xlink:href':'#'})
.on('click',function(){ fullSourcing(); return false; });
}
}
}
else {
// TODO for grids or scripts - show sourcing in the menu bar?
}
function makeSourceObj(container, ref_by_uid) {
if(cnt<0) { console.log('infinite loop?'); return container; }
cnt--;
allsources.forEach(function(src){
if(src.ref_by_uid==ref_by_uid) {
var linkval;
if($.isNumeric(src.ref_fid)) {
linkval = '<a href="'+src.ref_url+'" target="_blank">'+src.ref_filename+'</a>'; // TODO: service name
}
else {
var ref_user = src.ref_fid.split(':')[0],
fn = (ref_user!=window.user ? ref_user+': ' : '') + src.ref_filename;
linkval = '<a href="#" data-fid="'+src.ref_fid+'">'+fn+'</a>';
}
container[linkval] = makeSourceObj({},src.uid);
}
});
return container;
}
var cnt = allsources.length,
sourceObj = makeSourceObj({}, null);
function fullSourcing(){
var sourceModal = $('#sourceModal');
var sourceViewer = sourceModal.find('#source-viewer').empty();
sourceViewer.data('jsontree', '').jsontree(JSON.stringify(sourceObj),{terminators:false, collapsibleOuter:false}).show();
sourceModal.find('[data-fid]').click(function(){
sourceModal.modal('hide');
pullf({fid:$(this).attr('data-fid')});
return false;
});
sourceModal.modal('show');
sourceModal.find('.close').off('click').on('click', function(d, i){
sourceModal.modal('hide');
return false;
});
}
};
/*
* isEmpty
* @UTILITY
* check if object is empty and all arrays strings and objects within are empty
*/
lib.isEmpty = function (obj) {
/*
* Checks for empty arrays,
* objects and empty strings
* and objects and arrays that
* only contain empty arrays, objects
* and strings and so on.
*/
var keys, bools;
if (obj === null) { return true; }
if (typeof(obj) === 'object' ) {
keys = Object.keys(obj);
}
else if (typeof(obj) === 'string') {
return obj.length === 0;
}
else if ((obj === 0) || obj) { return false; }
else { return true; } // its undefined or null so its empty
if (keys.length === 0) {
return true;
}
else {
bools = keys.map( function(key) {
return lib.isEmpty(obj[key]);
});
}
/*
* now go through array and see if any are not empty
* if so it returns true, but we negate it to return
* false ie some contents are not empty.
*/
return !bools.some(function(c) { return !c; });
} |
<<<<<<<
it('should use *marker.colors*', function() {
_calc({
marker: { colors: ['pink', '#777', '#f00', '#ff0', '#0f0', '#0ff', '#00f', '#f0f', '#fff'] },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgba(255, 192, 203, 1)');
expect(cd[1].color).toEqual('rgba(119, 119, 119, 1)');
expect(cd[2].color).toEqual('rgba(255, 0, 0, 1)');
expect(cd[3].color).toEqual('rgba(255, 255, 0, 1)');
expect(cd[4].color).toEqual('rgba(0, 255, 0, 1)');
expect(cd[5].color).toEqual('rgba(0, 255, 255, 1)');
expect(cd[6].color).toEqual('rgba(0, 0, 255, 1)');
expect(cd[7].color).toEqual('rgba(255, 0, 255, 1)');
expect(cd[8].color).toEqual('rgba(255, 255, 255, 1)');
});
it('should use *marker.colors* numbers with default colorscale', function() {
_calc({
marker: { colors: [-4, -3, -2, -1, 0, 1, 2, 3, 4] },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(5, 10, 172)');
expect(cd[1].color).toEqual('rgb(41, 55, 199)');
expect(cd[2].color).toEqual('rgb(77, 101, 226)');
expect(cd[3].color).toEqual('rgb(120, 146, 238)');
expect(cd[4].color).toEqual('rgb(190, 190, 190)');
expect(cd[5].color).toEqual('rgb(223, 164, 122)');
expect(cd[6].color).toEqual('rgb(221, 123, 80)');
expect(cd[7].color).toEqual('rgb(200, 66, 54)');
expect(cd[8].color).toEqual('rgb(178, 10, 28)');
});
it('should use *marker.colors* numbers with desired colorscale', function() {
_calc({
marker: { colors: [1, 2, 3, 4, 5, 6, 7, 8, 9], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
});
it('should use *marker.colors* numbers not values with colorscale', function() {
_calc({
values: [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000],
marker: { colors: [1, 2, 3, 4, 5, 6, 7, 8, 9], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
});
it('should use values with colorscale when *marker.colors* in empty', function() {
_calc({
values: [1, 2, 3, 4, 5, 6, 7, 8, 9],
marker: { colors: [], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
});
=======
it('should compute correct sector *value* for generated implied root', function() {
_calc([{
labels: [ 'A', 'B', 'b'],
parents: ['Root', 'Root', 'B'],
values: [1, 2, 1],
branchvalues: 'remainder'
}, {
labels: [ 'A', 'B', 'b'],
parents: ['Root', 'Root', 'B'],
values: [1, 2, 1],
branchvalues: 'total'
}]);
expect(extractPt('data.data.id')).toEqual([
['Root', 'B', 'A', 'b'],
['Root', 'B', 'A', 'b']
]);
expect(extractPt('value')).toEqual([
[4, 3, 1, 1],
[3, 2, 1, 1]
]);
});
it('should compute correct sector *value* for generated "root of roots"', function() {
spyOn(Lib, 'randstr').and.callFake(function() { return 'dummy'; });
_calc([{
labels: [ 'A', 'B', 'b'],
parents: ['', '', 'B'],
values: [1, 2, 1],
branchvalues: 'remainder'
}, {
labels: [ 'A', 'B', 'b'],
parents: ['', '', 'B'],
values: [1, 2, 1],
branchvalues: 'total'
}]);
expect(extractPt('data.data.id')).toEqual([
['dummy', 'B', 'A', 'b'],
['dummy', 'B', 'A', 'b']
]);
expect(extractPt('value')).toEqual([
[4, 3, 1, 1],
[3, 2, 1, 1]
]);
});
>>>>>>>
it('should compute correct sector *value* for generated implied root', function() {
_calc([{
labels: [ 'A', 'B', 'b'],
parents: ['Root', 'Root', 'B'],
values: [1, 2, 1],
branchvalues: 'remainder'
}, {
labels: [ 'A', 'B', 'b'],
parents: ['Root', 'Root', 'B'],
values: [1, 2, 1],
branchvalues: 'total'
}]);
expect(extractPt('data.data.id')).toEqual([
['Root', 'B', 'A', 'b'],
['Root', 'B', 'A', 'b']
]);
expect(extractPt('value')).toEqual([
[4, 3, 1, 1],
[3, 2, 1, 1]
]);
});
it('should compute correct sector *value* for generated "root of roots"', function() {
spyOn(Lib, 'randstr').and.callFake(function() { return 'dummy'; });
_calc([{
labels: [ 'A', 'B', 'b'],
parents: ['', '', 'B'],
values: [1, 2, 1],
branchvalues: 'remainder'
}, {
labels: [ 'A', 'B', 'b'],
parents: ['', '', 'B'],
values: [1, 2, 1],
branchvalues: 'total'
}]);
expect(extractPt('data.data.id')).toEqual([
['dummy', 'B', 'A', 'b'],
['dummy', 'B', 'A', 'b']
]);
expect(extractPt('value')).toEqual([
[4, 3, 1, 1],
[3, 2, 1, 1]
]);
});
it('should use *marker.colors*', function() {
_calc({
marker: { colors: ['pink', '#777', '#f00', '#ff0', '#0f0', '#0ff', '#00f', '#f0f', '#fff'] },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgba(255, 192, 203, 1)');
expect(cd[1].color).toEqual('rgba(119, 119, 119, 1)');
expect(cd[2].color).toEqual('rgba(255, 0, 0, 1)');
expect(cd[3].color).toEqual('rgba(255, 255, 0, 1)');
expect(cd[4].color).toEqual('rgba(0, 255, 0, 1)');
expect(cd[5].color).toEqual('rgba(0, 255, 255, 1)');
expect(cd[6].color).toEqual('rgba(0, 0, 255, 1)');
expect(cd[7].color).toEqual('rgba(255, 0, 255, 1)');
expect(cd[8].color).toEqual('rgba(255, 255, 255, 1)');
});
it('should use *marker.colors* numbers with default colorscale', function() {
_calc({
marker: { colors: [-4, -3, -2, -1, 0, 1, 2, 3, 4] },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(5, 10, 172)');
expect(cd[1].color).toEqual('rgb(41, 55, 199)');
expect(cd[2].color).toEqual('rgb(77, 101, 226)');
expect(cd[3].color).toEqual('rgb(120, 146, 238)');
expect(cd[4].color).toEqual('rgb(190, 190, 190)');
expect(cd[5].color).toEqual('rgb(223, 164, 122)');
expect(cd[6].color).toEqual('rgb(221, 123, 80)');
expect(cd[7].color).toEqual('rgb(200, 66, 54)');
expect(cd[8].color).toEqual('rgb(178, 10, 28)');
});
it('should use *marker.colors* numbers with desired colorscale', function() {
_calc({
marker: { colors: [1, 2, 3, 4, 5, 6, 7, 8, 9], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
});
it('should use *marker.colors* numbers not values with colorscale', function() {
_calc({
values: [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000],
marker: { colors: [1, 2, 3, 4, 5, 6, 7, 8, 9], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
});
it('should use values with colorscale when *marker.colors* in empty', function() {
_calc({
values: [1, 2, 3, 4, 5, 6, 7, 8, 9],
marker: { colors: [], colorscale: 'Portland' },
labels: ['Eve', 'Cain', 'Seth', 'Enos', 'Noam', 'Abel', 'Awan', 'Enoch', 'Azura'],
parents: ['', 'Eve', 'Eve', 'Seth', 'Seth', 'Eve', 'Eve', 'Awan', 'Eve']
});
var cd = gd.calcdata[0];
expect(cd.length).toEqual(9);
expect(cd[0].color).toEqual('rgb(12, 51, 131)');
expect(cd[1].color).toEqual('rgb(11, 94, 159)');
expect(cd[2].color).toEqual('rgb(10, 136, 186)');
expect(cd[3].color).toEqual('rgb(126, 174, 121)');
expect(cd[4].color).toEqual('rgb(242, 211, 56)');
expect(cd[5].color).toEqual('rgb(242, 177, 56)');
expect(cd[6].color).toEqual('rgb(242, 143, 56)');
expect(cd[7].color).toEqual('rgb(230, 87, 43)');
expect(cd[8].color).toEqual('rgb(217, 30, 30)');
}); |
<<<<<<<
var oldModules = oldFullLayout._modules || [],
newModules = newFullLayout._modules || [];
var hadScatter, hasScatter, hadOHLC, hasOHLC, hadGl, hasGl, i, oldPlots, ids, subplotInfo, moduleName;
=======
var oldModules = oldFullLayout._modules || [];
var newModules = newFullLayout._modules || [];
var oldPlots = oldFullLayout._plots || {};
var hadScatter, hasScatter;
var hadGl, hasGl;
var i, k, subplotInfo, moduleName;
// when going from a large splom graph to something else,
// we need to clear <g subplot> so that the new cartesian subplot
// can have the correct layer ordering
if(oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) {
for(k in oldPlots) {
subplotInfo = oldPlots[k];
if(subplotInfo.plotgroup) subplotInfo.plotgroup.remove();
}
}
>>>>>>>
var oldModules = oldFullLayout._modules || [];
var newModules = newFullLayout._modules || [];
var oldPlots = oldFullLayout._plots || {};
var hadScatter, hasScatter;
var hadOHLC, hasOHLC;
var hadGl, hasGl;
var i, k, subplotInfo, moduleName;
// when going from a large splom graph to something else,
// we need to clear <g subplot> so that the new cartesian subplot
// can have the correct layer ordering
if(oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) {
for(k in oldPlots) {
subplotInfo = oldPlots[k];
if(subplotInfo.plotgroup) subplotInfo.plotgroup.remove();
}
}
<<<<<<<
oldPlots = oldFullLayout._plots;
var layersToEmpty = [];
if(hadScatter && !hasScatter) layersToEmpty.push('g.scatterlayer');
if(hadOHLC && !hasOHLC) layersToEmpty.push('g.ohlclayer');
if(layersToEmpty.length) {
ids = Object.keys(oldPlots || {});
for(var layeri = 0; layeri < layersToEmpty.length; layeri++) {
for(i = 0; i < ids.length; i++) {
subplotInfo = oldPlots[ids[i]];
if(subplotInfo.plot) {
subplotInfo.plot.select(layersToEmpty[layeri])
.selectAll('g.trace')
.remove();
}
=======
if(hadScatter && !hasScatter) {
for(k in oldPlots) {
subplotInfo = oldPlots[k];
if(subplotInfo.plot) {
subplotInfo.plot.select('g.scatterlayer')
.selectAll('g.trace')
.remove();
>>>>>>>
var layersToEmpty = [];
if(hadScatter && !hasScatter) layersToEmpty.push('g.scatterlayer');
if(hadOHLC && !hasOHLC) layersToEmpty.push('g.ohlclayer');
if(layersToEmpty.length) {
for(var layeri = 0; layeri < layersToEmpty.length; layeri++) {
for(k in oldPlots) {
subplotInfo = oldPlots[k];
if(subplotInfo.plot) {
subplotInfo.plot.select(layersToEmpty[layeri])
.selectAll('g.trace')
.remove();
}
<<<<<<<
ids = Object.keys(oldPlots || {});
for(i = 0; i < ids.length; i++) {
subplotInfo = oldPlots[ids[i]];
=======
for(k in oldPlots) {
subplotInfo = oldPlots[k];
>>>>>>>
for(k in oldPlots) {
subplotInfo = oldPlots[k]; |
<<<<<<<
var DESELECTDIM = 0.2;
=======
var transparent = [0, 0, 0, 0];
>>>>>>>
var DESELECTDIM = 0.2;
var transparent = [0, 0, 0, 0];
<<<<<<<
proto.update = function(options, cdscatter) {
=======
function isSymbolOpen(symbol) {
return symbol.split('-open')[1] === '';
}
function fillColor(colorIn, colorOut, offsetIn, offsetOut) {
for(var j = 0; j < 4; j++) {
colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j];
}
}
proto.update = function(options) {
>>>>>>>
function isSymbolOpen(symbol) {
return symbol.split('-open')[1] === '';
}
function fillColor(colorIn, colorOut, offsetIn, offsetOut) {
for(var j = 0; j < 4; j++) {
colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j];
}
}
proto.update = function(options, cdscatter) {
<<<<<<<
for(j = 0; j < 4; ++j) {
var color = colors[4 * index + j];
if(selIds && !selIds[index] && j === 3) {
color *= DESELECTDIM;
}
this.scatter.options.colors[4 * i + j] = color;
this.scatter.options.borderColors[4 * i + j] = borderColors[4 * index + j];
=======
if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) {
fillColor(this.scatter.options.colors, transparent, i, 0);
} else {
fillColor(this.scatter.options.colors, _colors, i, index);
>>>>>>>
// FIXME
for(j = 0; j < 4; ++j) {
var color = colors[4 * index + j];
if(selIds && !selIds[index] && j === 3) {
color *= DESELECTDIM;
}
this.scatter.options.colors[4 * i + j] = color;
this.scatter.options.borderColors[4 * i + j] = borderColors[4 * index + j];
}
if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) {
fillColor(this.scatter.options.colors, transparent, i, 0);
} else {
fillColor(this.scatter.options.colors, _colors, i, index); |
<<<<<<<
if(showLegend) {
coerce('bgcolor', layoutOut.paper_bgcolor);
coerce('bordercolor');
coerce('borderwidth');
coerce('font', layoutOut.font);
coerce('traceorder', defaultOrder);
coerce('x');
coerce('xanchor');
coerce('y');
coerce('yanchor');
Plotly.Lib.noneOrAll(containerIn, containerOut, ['x', 'y']);
coerce('hiddenslices');
}
=======
if(showLegend === false) return;
coerce('bgcolor', layoutOut.paper_bgcolor);
coerce('bordercolor');
coerce('borderwidth');
coerce('font', layoutOut.font);
coerce('traceorder', defaultOrder);
if(isGrouped(layoutOut.legend)) coerce('tracegroupgap');
coerce('x');
coerce('xanchor');
coerce('y');
coerce('yanchor');
Plotly.Lib.noneOrAll(containerIn, containerOut, ['x', 'y']);
>>>>>>>
if(showLegend === false) return;
coerce('bgcolor', layoutOut.paper_bgcolor);
coerce('bordercolor');
coerce('borderwidth');
coerce('font', layoutOut.font);
coerce('traceorder', defaultOrder);
if(isGrouped(layoutOut.legend)) coerce('tracegroupgap');
coerce('x');
coerce('xanchor');
coerce('y');
coerce('yanchor');
Plotly.Lib.noneOrAll(containerIn, containerOut, ['x', 'y']);
coerce('hiddenslices');
<<<<<<<
var opts = fullLayout.legend,
hiddenSlices = opts.hiddenslices || [];
var ldata = [],
slicesShown = {};
for(i = 0; i < td.calcdata.length; i++) {
var cd = td.calcdata[i],
cd0 = cd[0],
trace = cd0.trace;
if(Plotly.Plots.traceIs(trace, 'pie')) {
for(j = 0; j < cd.length; j++) {
labelj = cd[j].label;
if(!slicesShown[labelj]) {
ldata.push([{
label: labelj,
color: cd[j].color,
i: cd[j].i,
trace: trace
}]);
slicesShown[labelj] = true;
}
}
}
else if(legendGetsTrace(trace) && trace.showlegend) {
ldata.push([cd0]);
}
}
=======
var opts = fullLayout.legend,
legendData = legend.getLegendData(td.calcdata, opts);
>>>>>>>
var opts = fullLayout.legend,
legendData = legend.getLegendData(td.calcdata, opts),
hiddenSlices = opts.hiddenslices || [];
<<<<<<<
var trace = d[0].trace;
if(Plotly.Plots.traceIs(trace, 'pie')) {
var thisLabel = d[0].label,
newHiddenSlices = hiddenSlices.slice(),
thisLabelIndex = newHiddenSlices.indexOf(thisLabel);
if(thisLabelIndex === -1) newHiddenSlices.push(thisLabel);
else newHiddenSlices.splice(thisLabelIndex, 1);
Plotly.relayout(td, 'legend.hiddenslices', newHiddenSlices);
} else {
var newVisible = trace.visible === true ?
'legendonly' : true;
Plotly.restyle(td, 'visible', newVisible, trace.index);
}
=======
var fullData = td._fullData,
trace = d[0].trace,
legendgroup = trace.legendgroup,
traceIndicesInGroup = [],
tracei,
newVisible;
if(legendgroup === '') traceIndicesInGroup = [trace.index];
else {
for(var i = 0; i < fullData.length; i++) {
tracei = fullData[i];
if(tracei.legendgroup === legendgroup) {
traceIndicesInGroup.push(tracei.index);
}
}
}
newVisible = trace.visible === true ? 'legendonly' : true;
Plotly.restyle(td, 'visible', newVisible, traceIndicesInGroup);
>>>>>>>
var fullData = td._fullData,
trace = d[0].trace,
legendgroup = trace.legendgroup,
traceIndicesInGroup = [],
tracei,
newVisible;
if(Plotly.Plots.traceIs(trace, 'pie')) {
var thisLabel = d[0].label,
newHiddenSlices = hiddenSlices.slice(),
thisLabelIndex = newHiddenSlices.indexOf(thisLabel);
if(thisLabelIndex === -1) newHiddenSlices.push(thisLabel);
else newHiddenSlices.splice(thisLabelIndex, 1);
Plotly.relayout(td, 'legend.hiddenslices', newHiddenSlices);
} else {
if(legendgroup === '') {
traceIndicesInGroup = [trace.index];
} else {
for(var i = 0; i < fullData.length; i++) {
tracei = fullData[i];
if(tracei.legendgroup === legendgroup) {
traceIndicesInGroup.push(tracei.index);
}
}
}
newVisible = trace.visible === true ? 'legendonly' : true;
Plotly.restyle(td, 'visible', newVisible, traceIndicesInGroup);
} |
<<<<<<<
import { Help, Chat } from './rows';
import STRINGS from '../../config/localizedStrings';
=======
>>>>>>>
import STRINGS from '../../config/localizedStrings';
<<<<<<<
</div>
{isLogged ?
<div className="sidebar-row d-flex">
<Chat
className="f-1 title-font text-capitalize justify-content-center"
onMinimize={minimizeChat}
unreadMessages={unreadMessages}
chatIsClosed={chatIsClosed}
/>
<Help className="f-8" onHelp={help} />
{/* <Logout className="f-0" onLogout={logout} /> */}
</div> : ''}
=======
</div>: '' }
{/* {isLogged ?
<div className="sidebar-row d-flex">
<Chat
className="f-1 title-font text-capitalize justify-content-center"
onMinimize={minimizeChat}
unreadMessages={unreadMessages}
chatIsClosed={chatIsClosed}
/>
<Help className="f-8" onHelp={help} />
<Logout className="f-0" onLogout={logout} />
</div> : ''} */}
>>>>>>>
</div>
{/* {isLogged ?
<div className="sidebar-row d-flex">
<Chat
className="f-1 title-font text-capitalize justify-content-center"
onMinimize={minimizeChat}
unreadMessages={unreadMessages}
chatIsClosed={chatIsClosed}
/>
<Help className="f-8" onHelp={help} />
<Logout className="f-0" onLogout={logout} />
</div> : ''} */} |
<<<<<<<
uirevision: {
valType: 'any',
role: 'info',
editType: 'none',
description: [
'Controls persistence of user-driven changes in axis `range`,',
'`autorange`, `angle`, and `title` if in `editable: true` configuration.',
'Defaults to `polar<N>.uirevision`.'
].join(' ')
},
editType: 'calc'
=======
editType: 'calc',
_deprecated: {
title: axesAttrs._deprecated.title,
titlefont: axesAttrs._deprecated.titlefont
}
>>>>>>>
uirevision: {
valType: 'any',
role: 'info',
editType: 'none',
description: [
'Controls persistence of user-driven changes in axis `range`,',
'`autorange`, `angle`, and `title` if in `editable: true` configuration.',
'Defaults to `polar<N>.uirevision`.'
].join(' ')
},
editType: 'calc',
_deprecated: {
title: axesAttrs._deprecated.title,
titlefont: axesAttrs._deprecated.titlefont
} |
<<<<<<<
plots['tetrahedra'] = require('@mocks/gl3d_tet.json');
plots['connectgaps'] = require('@mocks/gl3d_scatter3d-connectgaps.json');
=======
plots['tet'] = require('@mocks/gl3d_tet.json');
plots['surface_intensity'] = require('@mocks/gl3d_surface_intensity.json');
>>>>>>>
plots['connectgaps'] = require('@mocks/gl3d_scatter3d-connectgaps.json');
plots['tet'] = require('@mocks/gl3d_tet.json');
plots['surface_intensity'] = require('@mocks/gl3d_surface_intensity.json'); |
<<<<<<<
var modulesWithErrorBars = gd._modules.concat(Plotly.ErrorBars),
i,
module;
=======
var subplots = Plotly.Axes.getSubplots(gd),
modulesWithErrorBars = Plotly.ErrorBars ?
gd._modules.concat(Plotly.ErrorBars) : gd._modules,
fullLayout = gd._fullLayout;
var i, j, gp, module;
for (i = 0; i < subplots.length; i++) {
gp = fullLayout._plots[subplots[i]].plot;
>>>>>>>
var modulesWithErrorBars = Plotly.ErrorBars ?
gd._modules.concat(Plotly.ErrorBars) : gd._modules,
i,
module; |
<<<<<<<
coerce('hoverlabel.bgcolor');
coerce('hoverlabel.bordercolor');
Lib.coerceFont(coerce, 'hoverlabel.font');
=======
if(plots.traceIs(traceOut, 'showLegend')) {
coerce('showlegend');
coerce('legendgroup');
}
>>>>>>>
if(plots.traceIs(traceOut, 'showLegend')) {
coerce('showlegend');
coerce('legendgroup');
}
coerce('hoverlabel.bgcolor');
coerce('hoverlabel.bordercolor');
Lib.coerceFont(coerce, 'hoverlabel.font'); |
<<<<<<<
it('@gl should only accept texts for textposition otherwise textposition is set to middle center before passing to webgl', function(done) {
Plotly.plot(gd, [{
type: 'scatter3d',
mode: 'markers+text+lines',
x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
y: [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16],
z: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
text: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],
textposition: ['left top', 'right top', 'left bottom', 'right bottom', null, undefined, true, false, [], {}, NaN, Infinity, 0, 1.2]
}])
.then(function() {
var AllTextpositions = gd._fullData[0].textposition;
expect(AllTextpositions[0]).toBe('top left', 'is not top left');
expect(AllTextpositions[1]).toBe('top right', 'is not top right');
expect(AllTextpositions[2]).toBe('bottom left', 'is not bottom left');
expect(AllTextpositions[3]).toBe('bottom right', 'is not bottom right');
for(var i = 4; i < AllTextpositions.length; i++) {
expect(AllTextpositions[i]).toBe('middle center', 'is not middle center');
}
})
.catch(failTest)
.then(done);
});
=======
it('@gl axis ticks should not be set when axis _length is NaN', function(done) {
Plotly.plot(gd,
{
data: [{
type: 'scatter3d',
mode: 'markers',
x: [1, 2],
y: [3, 4],
z: [5, 6]
}],
layout: {
scene: {
camera: {
eye: {x: 1, y: 1, z: 0},
center: {x: 0.5, y: 0.5, z: 1},
up: {x: 0, y: 0, z: 1}
}
}
}
}
)
.then(function() {
var zaxis = gd._fullLayout.scene.zaxis;
expect(isNaN(zaxis._length)).toBe(true);
expect(zaxis.dtick === undefined).toBe(true);
})
.catch(failTest)
.then(done);
});
>>>>>>>
it('@gl should only accept texts for textposition otherwise textposition is set to middle center before passing to webgl', function(done) {
Plotly.plot(gd, [{
type: 'scatter3d',
mode: 'markers+text+lines',
x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
y: [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16],
z: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
text: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],
textposition: ['left top', 'right top', 'left bottom', 'right bottom', null, undefined, true, false, [], {}, NaN, Infinity, 0, 1.2]
}])
.then(function() {
var AllTextpositions = gd._fullData[0].textposition;
expect(AllTextpositions[0]).toBe('top left', 'is not top left');
expect(AllTextpositions[1]).toBe('top right', 'is not top right');
expect(AllTextpositions[2]).toBe('bottom left', 'is not bottom left');
expect(AllTextpositions[3]).toBe('bottom right', 'is not bottom right');
for(var i = 4; i < AllTextpositions.length; i++) {
expect(AllTextpositions[i]).toBe('middle center', 'is not middle center');
}
})
.catch(failTest)
.then(done);
});
it('@gl axis ticks should not be set when axis _length is NaN', function(done) {
Plotly.plot(gd,
{
data: [{
type: 'scatter3d',
mode: 'markers',
x: [1, 2],
y: [3, 4],
z: [5, 6]
}],
layout: {
scene: {
camera: {
eye: {x: 1, y: 1, z: 0},
center: {x: 0.5, y: 0.5, z: 1},
up: {x: 0, y: 0, z: 1}
}
}
}
}
)
.then(function() {
var zaxis = gd._fullLayout.scene.zaxis;
expect(isNaN(zaxis._length)).toBe(true);
expect(zaxis.dtick === undefined).toBe(true);
})
.catch(failTest)
.then(done);
}); |
<<<<<<<
var maindrag = makeDragBox(gd, plotinfo, 0, 0,
=======
var maindrag = dragBox(gd, plotinfo, xa._offset, ya._offset,
>>>>>>>
var maindrag = makeDragBox(gd, plotinfo, xa._offset, ya._offset,
<<<<<<<
makeDragBox(gd, plotinfo, -DRAGGERSIZE, -DRAGGERSIZE,
=======
dragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset - DRAGGERSIZE,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset - DRAGGERSIZE,
<<<<<<<
makeDragBox(gd, plotinfo, xa._length, -DRAGGERSIZE,
=======
dragBox(gd, plotinfo, xa._offset + xa._length, ya._offset - DRAGGERSIZE,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset - DRAGGERSIZE,
<<<<<<<
makeDragBox(gd, plotinfo, -DRAGGERSIZE, ya._length,
=======
dragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset + ya._length,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset + ya._length,
<<<<<<<
makeDragBox(gd, plotinfo, xa._length, ya._length,
=======
dragBox(gd, plotinfo, xa._offset + xa._length, ya._offset + ya._length,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset + ya._length,
<<<<<<<
if(isNumeric(y0)) {
if(xa.anchor === 'free') y0 -= fullLayout._size.h * (1 - ya.domain[1]);
makeDragBox(gd, plotinfo, xa._length * 0.1, y0,
=======
if(subplot === xa._mainSubplot) {
// the y position of the main x axis line
var y0 = xa._mainLinePosition;
if(xa.side === 'top') y0 -= DRAGGERSIZE;
dragBox(gd, plotinfo, xa._offset + xa._length * 0.1, y0,
>>>>>>>
if(subplot === xa._mainSubplot) {
// the y position of the main x axis line
var y0 = xa._mainLinePosition;
if(xa.side === 'top') y0 -= DRAGGERSIZE;
makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.1, y0,
<<<<<<<
makeDragBox(gd, plotinfo, 0, y0,
=======
dragBox(gd, plotinfo, xa._offset, y0,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset, y0,
<<<<<<<
makeDragBox(gd, plotinfo, xa._length * 0.9, y0,
=======
dragBox(gd, plotinfo, xa._offset + xa._length * 0.9, y0,
>>>>>>>
makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.9, y0,
<<<<<<<
if(isNumeric(x0)) {
if(ya.anchor === 'free') x0 -= fullLayout._size.w * xa.domain[0];
makeDragBox(gd, plotinfo, x0, ya._length * 0.1,
=======
if(subplot === ya._mainSubplot) {
// the x position of the main y axis line
var x0 = ya._mainLinePosition;
if(ya.side !== 'right') x0 -= DRAGGERSIZE;
dragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.1,
>>>>>>>
if(subplot === ya._mainSubplot) {
// the x position of the main y axis line
var x0 = ya._mainLinePosition;
if(ya.side !== 'right') x0 -= DRAGGERSIZE;
makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.1,
<<<<<<<
makeDragBox(gd, plotinfo, x0, ya._length * 0.9,
=======
dragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.9,
>>>>>>>
makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.9,
<<<<<<<
makeDragBox(gd, plotinfo, x0, 0,
=======
dragBox(gd, plotinfo, x0, ya._offset,
>>>>>>>
makeDragBox(gd, plotinfo, x0, ya._offset, |
<<<<<<<
'<img src="/static/img/lil_share_white.png"/> Share'+
'</a>'+
'</div>'+
'</div>'
=======
'<img src="/static/img/lil_share_white.png"/> Share'+
'</a>'+
'</div>'
>>>>>>>
'<img src="/static/img/lil_share_white.png"/> Share'+
'</a>'+
'</div>'+
'</div>';
<<<<<<<
=======
hidebox();
>>>>>>>
hidebox(); |
<<<<<<<
it('should not scroll document while panning', function(done) {
var mock = {
data: [
{ type: 'scattergl', y: [1, 2, 3], x: [1, 2, 3] }
],
layout: {
width: 500,
height: 500
}
};
var sceneTarget, relayoutCallback = jasmine.createSpy('relayoutCallback');
function scroll(target, amt) {
return new Promise(function(resolve) {
target.dispatchEvent(new WheelEvent('wheel', {deltaY: amt || 1, cancelable: true}));
setTimeout(resolve, 0);
});
}
function touchDrag(target, start, end) {
return new Promise(function(resolve) {
touchEvent('touchstart', start[0], start[1], {element: target});
touchEvent('touchmove', end[0], end[1], {element: target});
touchEvent('touchend', end[0], end[1], {element: target});
setTimeout(resolve, 0);
});
}
function assertEvent(e) {
expect(e.defaultPrevented).toEqual(true);
relayoutCallback();
}
gd.addEventListener('touchstart', assertEvent);
gd.addEventListener('wheel', assertEvent);
Plotly.plot(gd, mock)
.then(function() {
sceneTarget = gd.querySelector('.nsewdrag');
return touchDrag(sceneTarget, [100, 100], [0, 0]);
})
.then(function() {
return scroll(sceneTarget);
})
.then(function() {
expect(relayoutCallback).toHaveBeenCalledTimes(1);
})
.catch(fail)
.then(done);
});
=======
it('should restyle opacity', function(done) {
// #2299
spyOn(ScatterGl, 'calc');
var dat = [{
'x': [1, 2, 3],
'y': [1, 2, 3],
'type': 'scattergl',
'mode': 'markers'
}];
Plotly.plot(gd, dat, {width: 500, height: 500})
.then(function() {
expect(ScatterGl.calc).toHaveBeenCalledTimes(1);
return Plotly.restyle(gd, {'opacity': 0.1});
})
.then(function() {
expect(ScatterGl.calc).toHaveBeenCalledTimes(2);
})
.catch(fail)
.then(done);
});
it('should update selected points', function(done) {
// #2298
var dat = [{
'x': [1],
'y': [1],
'type': 'scattergl',
'mode': 'markers',
'selectedpoints': [0]
}];
Plotly.plot(gd, dat, {
width: 500,
height: 500,
dragmode: 'select'
})
.then(function() {
var scene = gd._fullLayout._plots.xy._scene;
expect(scene.count).toBe(1);
expect(scene.selectBatch).toEqual([[0]]);
expect(scene.unselectBatch).toEqual([[]]);
spyOn(scene.scatter2d, 'draw');
var trace = {
x: [2],
y: [1],
type: 'scattergl',
mode: 'markers',
marker: {color: 'red'}
};
return Plotly.addTraces(gd, trace);
})
.then(function() {
var scene = gd._fullLayout._plots.xy._scene;
expect(scene.count).toBe(2);
expect(scene.selectBatch).toBeDefined();
expect(scene.unselectBatch).toBeDefined();
expect(scene.markerOptions.length).toBe(2);
expect(scene.markerOptions[1].color).toEqual(new Uint8Array([255, 0, 0, 255]));
expect(scene.scatter2d.draw).toHaveBeenCalled();
})
.catch(fail)
.then(done);
});
>>>>>>>
it('should not scroll document while panning', function(done) {
var mock = {
data: [
{ type: 'scattergl', y: [1, 2, 3], x: [1, 2, 3] }
],
layout: {
width: 500,
height: 500
}
};
var sceneTarget, relayoutCallback = jasmine.createSpy('relayoutCallback');
function scroll(target, amt) {
return new Promise(function(resolve) {
target.dispatchEvent(new WheelEvent('wheel', {deltaY: amt || 1, cancelable: true}));
setTimeout(resolve, 0);
});
}
function touchDrag(target, start, end) {
return new Promise(function(resolve) {
touchEvent('touchstart', start[0], start[1], {element: target});
touchEvent('touchmove', end[0], end[1], {element: target});
touchEvent('touchend', end[0], end[1], {element: target});
setTimeout(resolve, 0);
});
}
function assertEvent(e) {
expect(e.defaultPrevented).toEqual(true);
relayoutCallback();
}
gd.addEventListener('touchstart', assertEvent);
gd.addEventListener('wheel', assertEvent);
Plotly.plot(gd, mock)
.then(function() {
sceneTarget = gd.querySelector('.nsewdrag');
return touchDrag(sceneTarget, [100, 100], [0, 0]);
})
.then(function() {
return scroll(sceneTarget);
})
.then(function() {
expect(relayoutCallback).toHaveBeenCalledTimes(1);
})
.catch(fail)
.then(done);
});
it('should restyle opacity', function(done) {
// #2299
spyOn(ScatterGl, 'calc');
var dat = [{
'x': [1, 2, 3],
'y': [1, 2, 3],
'type': 'scattergl',
'mode': 'markers'
}];
Plotly.plot(gd, dat, {width: 500, height: 500})
.then(function() {
expect(ScatterGl.calc).toHaveBeenCalledTimes(1);
return Plotly.restyle(gd, {'opacity': 0.1});
})
.then(function() {
expect(ScatterGl.calc).toHaveBeenCalledTimes(2);
})
.catch(fail)
.then(done);
});
it('should update selected points', function(done) {
// #2298
var dat = [{
'x': [1],
'y': [1],
'type': 'scattergl',
'mode': 'markers',
'selectedpoints': [0]
}];
Plotly.plot(gd, dat, {
width: 500,
height: 500,
dragmode: 'select'
})
.then(function() {
var scene = gd._fullLayout._plots.xy._scene;
expect(scene.count).toBe(1);
expect(scene.selectBatch).toEqual([[0]]);
expect(scene.unselectBatch).toEqual([[]]);
spyOn(scene.scatter2d, 'draw');
var trace = {
x: [2],
y: [1],
type: 'scattergl',
mode: 'markers',
marker: {color: 'red'}
};
return Plotly.addTraces(gd, trace);
})
.then(function() {
var scene = gd._fullLayout._plots.xy._scene;
expect(scene.count).toBe(2);
expect(scene.selectBatch).toBeDefined();
expect(scene.unselectBatch).toBeDefined();
expect(scene.markerOptions.length).toBe(2);
expect(scene.markerOptions[1].color).toEqual(new Uint8Array([255, 0, 0, 255]));
expect(scene.scatter2d.draw).toHaveBeenCalled();
})
.catch(fail)
.then(done);
}); |
<<<<<<<
it('should generate hover label info (hoverinfo: \'text\' + \'hovertext\' array case)', function(done) {
Plotly.restyle(gd, 'hovertext', ['Apple', 'Banana', 'Orange']).then(function() {
var xval = 11,
yval = 11;
var out = hoverPoints(getPointData(gd), xval, yval)[0];
expect(out.extraText).toEqual('Apple');
done();
});
});
=======
});
describe('@noCI Test plotly events on a scattermapbox plot:', function() {
var mock = require('@mocks/mapbox_0.json');
var mockCopy, gd;
var blankPos = [10, 10],
pointPos,
nearPos;
function getPointData(gd) {
var cd = gd.calcdata,
mapbox = gd._fullLayout.mapbox._subplot;
return {
index: false,
distance: 20,
cd: cd[0],
trace: cd[0][0].trace,
xa: mapbox.xaxis,
ya: mapbox.yaxis
};
}
beforeAll(function(done) {
jasmine.addMatchers(customMatchers);
gd = createGraphDiv();
mockCopy = Lib.extendDeep({}, mock);
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
var bb = gd._fullLayout.mapbox._subplot.div.getBoundingClientRect(),
xval = 10,
yval = 10,
point = ScatterMapbox.hoverPoints(getPointData(gd), xval, yval)[0];
pointPos = [Math.floor(bb.left + (point.x0 + point.x1) / 2),
Math.floor(bb.top + (point.y0 + point.y1) / 2)];
nearPos = [pointPos[0] - 30, pointPos[1] - 30];
}).then(destroyGraphDiv).then(done);
});
beforeEach(function() {
gd = createGraphDiv();
mockCopy = Lib.extendDeep({}, mock);
});
afterEach(destroyGraphDiv);
describe('click events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_click', function(data) {
futureData = data;
});
});
it('should not be trigged when not on data points', function() {
click(blankPos[0], blankPos[1]);
expect(futureData).toBe(undefined);
});
it('should contain the correct fields', function() {
click(pointPos[0], pointPos[1]);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
});
});
describe('modified click events', function() {
var clickOpts = {
altKey: true,
ctrlKey: true,
metaKey: true,
shiftKey: true
},
futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_click', function(data) {
futureData = data;
});
});
it('should not be trigged when not on data points', function() {
click(blankPos[0], blankPos[1], clickOpts);
expect(futureData).toBe(undefined);
});
it('should contain the correct fields', function() {
click(pointPos[0], pointPos[1], clickOpts);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
Object.getOwnPropertyNames(clickOpts).forEach(function(opt) {
expect(evt[opt]).toEqual(clickOpts[opt], 'event.' + opt);
});
});
});
describe('hover events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_hover', function(data) {
futureData = data;
});
});
it('should contain the correct fields', function() {
mouseEvent('mousemove', blankPos[0], blankPos[1]);
mouseEvent('mousemove', pointPos[0], pointPos[1]);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
});
});
describe('unhover events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_unhover', function(data) {
futureData = data;
});
});
it('should contain the correct fields', function(done) {
move(pointPos[0], pointPos[1], nearPos[0], nearPos[1], HOVERMINTIME + 10).then(function() {
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(nearPos[0], 'event.clientX');
expect(evt.clientY).toEqual(nearPos[1], 'event.clientY');
}).then(done);
});
});
>>>>>>>
it('should generate hover label info (hoverinfo: \'text\' + \'hovertext\' array case)', function(done) {
Plotly.restyle(gd, 'hovertext', ['Apple', 'Banana', 'Orange']).then(function() {
var xval = 11,
yval = 11;
var out = hoverPoints(getPointData(gd), xval, yval)[0];
expect(out.extraText).toEqual('Apple');
done();
});
});
});
describe('@noCI Test plotly events on a scattermapbox plot:', function() {
var mock = require('@mocks/mapbox_0.json');
var mockCopy, gd;
var blankPos = [10, 10],
pointPos,
nearPos;
function getPointData(gd) {
var cd = gd.calcdata,
mapbox = gd._fullLayout.mapbox._subplot;
return {
index: false,
distance: 20,
cd: cd[0],
trace: cd[0][0].trace,
xa: mapbox.xaxis,
ya: mapbox.yaxis
};
}
beforeAll(function(done) {
jasmine.addMatchers(customMatchers);
gd = createGraphDiv();
mockCopy = Lib.extendDeep({}, mock);
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
var bb = gd._fullLayout.mapbox._subplot.div.getBoundingClientRect(),
xval = 10,
yval = 10,
point = ScatterMapbox.hoverPoints(getPointData(gd), xval, yval)[0];
pointPos = [Math.floor(bb.left + (point.x0 + point.x1) / 2),
Math.floor(bb.top + (point.y0 + point.y1) / 2)];
nearPos = [pointPos[0] - 30, pointPos[1] - 30];
}).then(destroyGraphDiv).then(done);
});
beforeEach(function() {
gd = createGraphDiv();
mockCopy = Lib.extendDeep({}, mock);
});
afterEach(destroyGraphDiv);
describe('click events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_click', function(data) {
futureData = data;
});
});
it('should not be trigged when not on data points', function() {
click(blankPos[0], blankPos[1]);
expect(futureData).toBe(undefined);
});
it('should contain the correct fields', function() {
click(pointPos[0], pointPos[1]);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
});
});
describe('modified click events', function() {
var clickOpts = {
altKey: true,
ctrlKey: true,
metaKey: true,
shiftKey: true
},
futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_click', function(data) {
futureData = data;
});
});
it('should not be trigged when not on data points', function() {
click(blankPos[0], blankPos[1], clickOpts);
expect(futureData).toBe(undefined);
});
it('should contain the correct fields', function() {
click(pointPos[0], pointPos[1], clickOpts);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
Object.getOwnPropertyNames(clickOpts).forEach(function(opt) {
expect(evt[opt]).toEqual(clickOpts[opt], 'event.' + opt);
});
});
});
describe('hover events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_hover', function(data) {
futureData = data;
});
});
it('should contain the correct fields', function() {
mouseEvent('mousemove', blankPos[0], blankPos[1]);
mouseEvent('mousemove', pointPos[0], pointPos[1]);
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
});
});
describe('unhover events', function() {
var futureData;
beforeEach(function(done) {
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
gd.on('plotly_unhover', function(data) {
futureData = data;
});
});
it('should contain the correct fields', function(done) {
move(pointPos[0], pointPos[1], nearPos[0], nearPos[1], HOVERMINTIME + 10).then(function() {
var pt = futureData.points[0],
evt = futureData.event;
expect(Object.keys(pt)).toEqual([
'data', 'fullData', 'curveNumber', 'pointNumber', 'lon', 'lat'
]);
expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber');
expect(typeof pt.data).toEqual(typeof {}, 'points[0].data');
expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData');
expect(pt.lat).toEqual(undefined, 'points[0].lat');
expect(pt.lon).toEqual(undefined, 'points[0].lon');
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
expect(evt.clientX).toEqual(nearPos[0], 'event.clientX');
expect(evt.clientY).toEqual(nearPos[1], 'event.clientY');
}).then(done);
});
}); |
<<<<<<<
};
plots.rehover = function(gd) {
if(gd._fullLayout._rehover) {
gd._fullLayout._rehover();
}
=======
};
plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLayout) {
var traceHashOld = subplot.traceHash,
traceHash = {},
i;
function filterVisible(calcDataIn) {
var calcDataOut = [];
for(var i = 0; i < calcDataIn.length; i++) {
var calcTrace = calcDataIn[i],
trace = calcTrace[0].trace;
if(trace.visible === true) calcDataOut.push(calcTrace);
}
return calcDataOut;
}
// build up moduleName -> calcData hash
for(i = 0; i < subplotCalcData.length; i++) {
var calcTraces = subplotCalcData[i],
trace = calcTraces[0].trace;
// skip over visible === false traces
// as they don't have `_module` ref
if(trace.visible) {
traceHash[trace.type] = traceHash[trace.type] || [];
traceHash[trace.type].push(calcTraces);
}
}
var moduleNamesOld = Object.keys(traceHashOld);
var moduleNames = Object.keys(traceHash);
// when a trace gets deleted, make sure that its module's
// plot method is called so that it is properly
// removed from the DOM.
for(i = 0; i < moduleNamesOld.length; i++) {
var moduleName = moduleNamesOld[i];
if(moduleNames.indexOf(moduleName) === -1) {
var fakeCalcTrace = traceHashOld[moduleName][0],
fakeTrace = fakeCalcTrace[0].trace;
fakeTrace.visible = false;
traceHash[moduleName] = [fakeCalcTrace];
}
}
// update list of module names to include 'fake' traces added above
moduleNames = Object.keys(traceHash);
// call module plot method
for(i = 0; i < moduleNames.length; i++) {
var moduleCalcData = traceHash[moduleNames[i]],
_module = moduleCalcData[0][0].trace._module;
_module.plot(subplot, filterVisible(moduleCalcData), subplotLayout);
}
// update moduleName -> calcData hash
subplot.traceHash = traceHash;
>>>>>>>
};
plots.rehover = function(gd) {
if(gd._fullLayout._rehover) {
gd._fullLayout._rehover();
}
};
plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLayout) {
var traceHashOld = subplot.traceHash,
traceHash = {},
i;
function filterVisible(calcDataIn) {
var calcDataOut = [];
for(var i = 0; i < calcDataIn.length; i++) {
var calcTrace = calcDataIn[i],
trace = calcTrace[0].trace;
if(trace.visible === true) calcDataOut.push(calcTrace);
}
return calcDataOut;
}
// build up moduleName -> calcData hash
for(i = 0; i < subplotCalcData.length; i++) {
var calcTraces = subplotCalcData[i],
trace = calcTraces[0].trace;
// skip over visible === false traces
// as they don't have `_module` ref
if(trace.visible) {
traceHash[trace.type] = traceHash[trace.type] || [];
traceHash[trace.type].push(calcTraces);
}
}
var moduleNamesOld = Object.keys(traceHashOld);
var moduleNames = Object.keys(traceHash);
// when a trace gets deleted, make sure that its module's
// plot method is called so that it is properly
// removed from the DOM.
for(i = 0; i < moduleNamesOld.length; i++) {
var moduleName = moduleNamesOld[i];
if(moduleNames.indexOf(moduleName) === -1) {
var fakeCalcTrace = traceHashOld[moduleName][0],
fakeTrace = fakeCalcTrace[0].trace;
fakeTrace.visible = false;
traceHash[moduleName] = [fakeCalcTrace];
}
}
// update list of module names to include 'fake' traces added above
moduleNames = Object.keys(traceHash);
// call module plot method
for(i = 0; i < moduleNames.length; i++) {
var moduleCalcData = traceHash[moduleNames[i]],
_module = moduleCalcData[0][0].trace._module;
_module.plot(subplot, filterVisible(moduleCalcData), subplotLayout);
}
// update moduleName -> calcData hash
subplot.traceHash = traceHash; |
<<<<<<<
var mouseEvent = require('../assets/mouse_event');
=======
var selectButton = require('../assets/modebar_button');
var customMatchers = require('../assets/custom_matchers');
>>>>>>>
var mouseEvent = require('../assets/mouse_event');
var selectButton = require('../assets/modebar_button');
var customMatchers = require('../assets/custom_matchers'); |
<<<<<<<
// plot_bgcolor only makes sense if there's a (2D) plot!
// TODO: bgcolor for each subplot, to inherit from the main one
var plot_bgcolor = Color.background;
if(xaList.length && yaList.length) {
plot_bgcolor = Lib.coerce(layoutIn, layoutOut, Plots.layoutAttributes, 'plot_bgcolor');
}
var bgColor = Color.combine(plot_bgcolor, layoutOut.paper_bgcolor);
xaList.concat(yaList).forEach(function(axName) {
=======
axesList.concat(yaList).forEach(function(axName) {
>>>>>>>
// plot_bgcolor only makes sense if there's a (2D) plot!
// TODO: bgcolor for each subplot, to inherit from the main one
var plot_bgcolor = Color.background;
if(xaList.length && yaList.length) {
plot_bgcolor = Lib.coerce(layoutIn, layoutOut, Plots.layoutAttributes, 'plot_bgcolor');
}
var bgColor = Color.combine(plot_bgcolor, layoutOut.paper_bgcolor);
axesList.forEach(function(axName) {
<<<<<<<
=======
// quick second pass for rangeslider defaults
axesList.forEach(function(axName) {
var axLetter = axName.charAt(0),
counterAxes = {x: yaList, y: xaList}[axLetter];
RangeSlider.supplyLayoutDefaults(layoutIn, layoutOut, axName, counterAxes);
});
// plot_bgcolor only makes sense if there's a (2D) plot!
// TODO: bgcolor for each subplot, to inherit from the main one
if(xaList.length && yaList.length) {
Lib.coerce(layoutIn, layoutOut, Plots.layoutAttributes, 'plot_bgcolor');
}
>>>>>>>
// quick second pass for rangeslider defaults
axesList.forEach(function(axName) {
var axLetter = axName.charAt(0),
counterAxes = {x: yaList, y: xaList}[axLetter];
RangeSlider.supplyLayoutDefaults(layoutIn, layoutOut, axName, counterAxes);
}); |
<<<<<<<
annotations.draw = function(gd,index,opt,value) {
var gl = gd.layout,
gs = gl._size,
=======
annotations.draw = function(gd, index, opt, value) {
var layout = gd.layout,
fullLayout = gd._fullLayout,
gs = fullLayout._size,
>>>>>>>
annotations.draw = function(gd, index, opt, value) {
var layout = gd.layout,
fullLayout = gd._fullLayout,
gs = fullLayout._size,
<<<<<<<
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) dragged = true;
arrowgroup.attr({
transform: 'translate('+dx+','+dy+')'
});
=======
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) gd.dragged = true;
arrowgroup.attr('transform', 'translate('+dx+','+dy+')');
>>>>>>>
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) dragged = true;
arrowgroup.attr('transform', 'translate('+dx+','+dy+')');
<<<<<<<
if(dragged) Plotly.relayout(gd,update);
=======
if(gd.dragged) Plotly.relayout(gd,update);
>>>>>>>
if(dragged) Plotly.relayout(gd,update);
<<<<<<<
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) dragged = true;
=======
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) gd.dragged = true;
>>>>>>>
if(Math.abs(dx)<MINDRAG) dx=0;
if(Math.abs(dy)<MINDRAG) dy=0;
if(dx||dy) dragged = true; |
<<<<<<<
var moduleLayoutDefaults = ['Axes', 'Legend', 'Annotations', 'Shapes', 'Fx',
'Bars', 'Boxes', 'Gl3dLayout', 'Pie'];
=======
var moduleLayoutDefaults = [
'Axes', 'Legend', 'Annotations', 'Shapes', 'Fx',
'Bars', 'Boxes', 'Gl3dLayout', 'GeoLayout'
];
>>>>>>>
var moduleLayoutDefaults = [
'Axes', 'Legend', 'Annotations', 'Shapes', 'Fx',
'Bars', 'Boxes', 'Gl3dLayout', 'GeoLayout', 'Pie'
];
<<<<<<<
// for flattening 3D into static images within the SVG, insert a layer here
=======
// fill in image server scrape-svg
>>>>>>>
// fill in image server scrape-svg
<<<<<<<
=======
fullLayout._geoimages = fullLayout._paper.append('g').classed('geoimages', true);
>>>>>>>
fullLayout._geoimages = fullLayout._paper.append('g').classed('geoimages', true); |
<<<<<<<
this.glDataMap = {};
=======
if (!this.shell) {
return;
}
this.camera = camera(shell);
>>>>>>>
this.glDataMap = {};
if (!this.shell) {
return;
}
this.camera = camera(shell); |
<<<<<<<
var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
=======
var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
>>>>>>>
var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
<<<<<<<
describe('Plotly.purge', function() {
afterEach(destroyGraphDiv);
it('should return the graph div in its original state', function(done) {
var gd = createGraphDiv();
var initialKeys = Object.keys(gd);
var intialHTML = gd.innerHTML;
var mockData = [{ x: [1,2,3], y: [2,3,4] }];
Plotly.plot(gd, mockData).then(function() {
Plotly.purge(gd);
expect(Object.keys(gd)).toEqual(initialKeys);
expect(gd.innerHTML).toEqual(intialHTML);
done();
});
});
});
=======
describe('cleanData', function() {
var gd;
beforeEach(function() {
gd = createGraphDiv();
});
afterEach(destroyGraphDiv);
it('should rename \'YIGnBu\' colorscales YlGnBu (2dMap case)', function() {
var data = [{
type: 'heatmap',
colorscale: 'YIGnBu'
}];
Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('YlGnBu');
});
it('should rename \'YIGnBu\' colorscales YlGnBu (markerColorscale case)', function() {
var data = [{
type: 'scattergeo',
marker: { colorscale: 'YIGnBu' }
}];
Plotly.plot(gd, data);
expect(gd.data[0].marker.colorscale).toBe('YlGnBu');
});
it('should rename \'YIOrRd\' colorscales YlOrRd (2dMap case)', function() {
var data = [{
type: 'contour',
colorscale: 'YIOrRd'
}];
Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('YlOrRd');
});
it('should rename \'YIOrRd\' colorscales YlOrRd (markerColorscale case)', function() {
var data = [{
type: 'scattergeo',
marker: { colorscale: 'YIOrRd' }
}];
Plotly.plot(gd, data);
expect(gd.data[0].marker.colorscale).toBe('YlOrRd');
});
});
>>>>>>>
describe('Plotly.purge', function() {
afterEach(destroyGraphDiv);
it('should return the graph div in its original state', function(done) {
var gd = createGraphDiv();
var initialKeys = Object.keys(gd);
var intialHTML = gd.innerHTML;
var mockData = [{ x: [1,2,3], y: [2,3,4] }];
Plotly.plot(gd, mockData).then(function() {
Plotly.purge(gd);
expect(Object.keys(gd)).toEqual(initialKeys);
expect(gd.innerHTML).toEqual(intialHTML);
done();
});
});
});
describe('cleanData', function() {
var gd;
beforeEach(function() {
gd = createGraphDiv();
});
afterEach(destroyGraphDiv);
it('should rename \'YIGnBu\' colorscales YlGnBu (2dMap case)', function() {
var data = [{
type: 'heatmap',
colorscale: 'YIGnBu'
}];
Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('YlGnBu');
});
it('should rename \'YIGnBu\' colorscales YlGnBu (markerColorscale case)', function() {
var data = [{
type: 'scattergeo',
marker: { colorscale: 'YIGnBu' }
}];
Plotly.plot(gd, data);
expect(gd.data[0].marker.colorscale).toBe('YlGnBu');
});
it('should rename \'YIOrRd\' colorscales YlOrRd (2dMap case)', function() {
var data = [{
type: 'contour',
colorscale: 'YIOrRd'
}];
Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('YlOrRd');
});
it('should rename \'YIOrRd\' colorscales YlOrRd (markerColorscale case)', function() {
var data = [{
type: 'scattergeo',
marker: { colorscale: 'YIOrRd' }
}];
Plotly.plot(gd, data);
expect(gd.data[0].marker.colorscale).toBe('YlOrRd');
});
}); |
<<<<<<<
labelShift = 0,
gridWidth = Plotly.Drawing.crispRound(td, ax.gridwidth, 1),
zeroLineWidth = Plotly.Drawing.crispRound(td, ax.zerolinewidth, gridWidth),
tickWidth = Plotly.Drawing.crispRound(td, ax.tickwidth, 1),
sides, transfn, tickpathfn,
=======
gridWidth = Plotly.Drawing.crispRound(gd, ax.gridwidth, 1),
zeroLineWidth = Plotly.Drawing.crispRound(gd, ax.zerolinewidth, gridWidth),
tickWidth = Plotly.Drawing.crispRound(gd, ax.tickwidth, 1),
sides, transfn, tickprefix, tickmid,
>>>>>>>
gridWidth = Plotly.Drawing.crispRound(gd, ax.gridwidth, 1),
zeroLineWidth = Plotly.Drawing.crispRound(gd, ax.zerolinewidth, gridWidth),
tickWidth = Plotly.Drawing.crispRound(gd, ax.tickwidth, 1),
sides, transfn, tickprefix, tickmid,
<<<<<<<
drawAxTitle(axid);
=======
Titles.draw(gd, axid + 'title');
>>>>>>>
drawAxTitle(axid);
<<<<<<<
// a full redraw of the title (mostly relevant for MathJax)
drawAxTitle(axid);
=======
// a full redraw of the title (modtly relevant for MathJax)
if(!skipTitle) Titles.draw(gd, axid + 'title');
>>>>>>>
// a full redraw of the title (mostly relevant for MathJax)
drawAxTitle(axid);
<<<<<<<
if(zlcontainer) {
var hasBarsOrFill = false;
for(var i = 0; i < td._fullData.length; i++) {
if(traceHasBarsOrFill(td._fullData[i], subplot)) {
hasBarsOrFill = true;
break;
}
=======
var hasBarsOrFill = false;
for(var i = 0; i < gd._fullData.length; i++) {
if(traceHasBarsOrFill(gd._fullData[i], subplot)) {
hasBarsOrFill = true;
break;
>>>>>>>
if(zlcontainer) {
var hasBarsOrFill = false;
for(var i = 0; i < gd._fullData.length; i++) {
if(traceHasBarsOrFill(gd._fullData[i], subplot)) {
hasBarsOrFill = true;
break;
} |
<<<<<<<
Lib.markTime('done with calcdata for ' + i);
=======
>>>>>>>
<<<<<<<
traces = gd.data.map(function(v, i) { return i; });
=======
traces = gd._fullData.map(function(v, i) { return i; });
>>>>>>>
traces = gd.data.map(function(v, i) { return i; }); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.