Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshlilha committed Feb 13, 2020
2 parents b8b4cd1 + 9cdcf41 commit cb8726a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 49 deletions.
2 changes: 1 addition & 1 deletion dist/muze.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/muze.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import SurrogateSideEffect from '../surrogate';
import { strategies } from './strategy';
import { HIGHLIGHTER } from '../../enums/side-effects';
import { getFormattedSet } from './helper';

export default class PlotHighlighter extends SurrogateSideEffect {
constructor (...params) {
Expand Down Expand Up @@ -34,21 +33,8 @@ export default class PlotHighlighter extends SurrogateSideEffect {

apply (selectionSet, payload, options = {}) {
const currentStrategy = this._strategies[options.strategy || this._strategy];
const excludeSetIds = this.getExcludeSetIds(options.excludeSet);

// Get all sets except the excludeSet points
const formattedSet = {
...selectionSet,
completeSet: getFormattedSet(selectionSet.completeSet, excludeSetIds),
entrySet: getFormattedSet(selectionSet.entrySet[1], excludeSetIds),
exitSet: getFormattedSet(selectionSet.exitSet[1], excludeSetIds),
mergedEnter: getFormattedSet(selectionSet.mergedEnter, excludeSetIds),
mergedExit: getFormattedSet(selectionSet.mergedExit, excludeSetIds)
};

const totalSet = { selectionSet, formattedSet };

currentStrategy(totalSet, this, payload, excludeSetIds);
currentStrategy(selectionSet, this, payload);

return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { intersect, difference } from 'muze-utils';
import { getFormattedSet } from './helper';
import { BEHAVIOURS } from '../..';

const fadeFn = (set, context) => {
const { formattedSet } = set;
const {
mergedEnter,
mergedExit,
exitSet,
completeSet
} = formattedSet;
} = set;

if (!mergedEnter.length && !mergedExit.length) {
context.applyInteractionStyle(completeSet, { interactionType: 'fade', apply: false });
Expand All @@ -22,23 +19,21 @@ const fadeFn = (set, context) => {
// Apply style only on the hovered layer
if (layerName === 'area') {
context.applyInteractionStyle(mergedEnter, { interactionType: 'fade', apply: true }, [layer]);
context.applyInteractionStyle(exitSet, { interactionType: 'fade', apply: false }, [layer]);
context.applyInteractionStyle(mergedExit, { interactionType: 'fade', apply: false }, [layer]);
} else {
context.applyInteractionStyle(exitSet, { interactionType: 'fade', apply: true }, [layer]);
context.applyInteractionStyle(mergedExit, { interactionType: 'fade', apply: true }, [layer]);
context.applyInteractionStyle(mergedEnter, { interactionType: 'fade', apply: false }, [layer]);
}
});
}
};

const fadeOnBrushFn = (set, context, payload) => {
const { formattedSet } = set;
const {
exitSet,
mergedEnter,
mergedExit,
completeSet
} = formattedSet;
} = set;

const { dragEnd } = payload;
let interactionType = 'brushStroke';
Expand All @@ -60,7 +55,7 @@ const fadeOnBrushFn = (set, context, payload) => {
// Apply style only on the hovered layer
if (layerName === 'area') {
if (dragEnd) {
context.applyInteractionStyle(exitSet, { interactionType: 'fade', apply: false }, [layer]);
context.applyInteractionStyle(mergedExit, { interactionType: 'fade', apply: false }, [layer]);
mergedEnter.length &&
context.applyInteractionStyle(mergedEnter, { interactionType: 'focus', apply: true }, [layer]);
}
Expand All @@ -85,13 +80,11 @@ export const strategies = {
fade: fadeFn,
fadeOnBrush: fadeOnBrushFn,
focus: (set, context) => {
const { formattedSet } = set;
const {
entrySet,
mergedEnter,
mergedExit,
completeSet
} = formattedSet;
} = set;
const { firebolt } = context;

if (!mergedEnter.length && !mergedExit.length) {
Expand All @@ -100,7 +93,7 @@ export const strategies = {
context.applyInteractionStyle(completeSet, { interactionType: 'commonDoubleStroke', apply: false });
} else {
context.applyInteractionStyle(mergedExit, { interactionType: 'focusStroke', apply: false });
context.applyInteractionStyle(entrySet, { interactionType: 'focusStroke', apply: true });
context.applyInteractionStyle(mergedEnter, { interactionType: 'focusStroke', apply: true });

const payload = firebolt.getPayload(BEHAVIOURS.HIGHLIGHT) || {};
const entryExitSet = firebolt.getEntryExitSet(BEHAVIOURS.HIGHLIGHT);
Expand Down Expand Up @@ -139,9 +132,7 @@ export const strategies = {
});
}
},
highlight: (set, context, payload, excludeSetIds) => {
const { selectionSet } = set;

highlight: (selectionSet, context, payload) => {
if (!selectionSet.mergedEnter.length && !selectionSet.mergedExit.length) {
// Remove focusStroke on selected but currently non-highlighted set
context.applyInteractionStyle(selectionSet.completeSet, { interactionType: 'highlight', apply: false });
Expand All @@ -154,9 +145,7 @@ export const strategies = {
layers.forEach((layer) => {
if (payload.target !== null) {
// get uids of only the currently highlighted point
const actualPoint = layer.getUidsFromPayload(selectionSet.mergedEnter, payload.target);
// get uids of only the currently highlighted point excluding the excludeSet ids
const currentHighlightedSet = getFormattedSet(actualPoint, excludeSetIds);
const currentHighlightedSet = layer.getUidsFromPayload(selectionSet.mergedEnter, payload.target);

// Apply highlight on the currently hovered point
context.applyInteractionStyle(currentHighlightedSet,
Expand All @@ -171,9 +160,9 @@ export const strategies = {

const selectEntrySet = context.firebolt.getEntryExitSet('select');
if (selectEntrySet) {
const commonSet = intersect(selectEntrySet.mergedEnter.uids, actualPoint.uids,
const commonSet = intersect(selectEntrySet.mergedEnter.uids, currentHighlightedSet.uids,
[v => v[0], v => v[0]]);
const diffSet = difference(selectEntrySet.mergedEnter.uids, actualPoint.uids,
const diffSet = difference(selectEntrySet.mergedEnter.uids, currentHighlightedSet.uids,
[v => v[0], v => v[0]]);

if (commonSet.length) {
Expand All @@ -192,10 +181,9 @@ export const strategies = {
}
},
pseudoFocus: (set, context) => {
const { formattedSet } = set;
const {
mergedEnter
} = formattedSet;
} = set;

context.applyInteractionStyle(mergedEnter, { interactionType: 'focus', apply: false });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/muze/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "muze",
"private": true,
"version": "1.3.1",
"version": "1.3.2",
"description": "Composable visualisation library for web with a data-first approach",
"homepage": "https://muzejs.org",
"author": "Muzejs.org (https://muzejs.org/)",
Expand Down
3 changes: 1 addition & 2 deletions packages/visual-layer/src/layers/line/line-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ export const LineLayerMixin = superclass => class extends superclass {

this._points = [];
this._pointMap = {};
containerSelection.classed(qualifiedClassName.join(' '), true);
containerSelection.classed(className, true);
containerSelection.attr('class', `${qualifiedClassName.join(' ')} ${className}`);

const colorValFn = encoding.color.value;
const translatedPoints = this.getTranslatedData(normalizedData, colorValFn, colorFieldIndex, axes);
Expand Down
4 changes: 2 additions & 2 deletions packages/visual-unit/src/firebolt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
const sideEffectPolicy = (propPayload, firebolt, propagationInf) => {
const { sourceIdentifiers, propagationData } = propagationInf;
const fields = sourceIdentifiers.fields;
const sourceIdentifierFields = Object.keys(fields).filter(field =>
field.type !== FieldType.MEASURE);
const sourceIdentifierFields = fields.filter(field =>
field.type !== FieldType.MEASURE).map(field => field.name);
const propFields = Object.keys(propagationData.getFieldsConfig());
const hasCommonCanvas = propPayload.sourceCanvas === firebolt.sourceCanvas();
return intersect(sourceIdentifierFields, propFields).length || hasCommonCanvas;
Expand Down
2 changes: 1 addition & 1 deletion release/dist/muze.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/dist/muze.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "muze",
"version": "1.3.1",
"version": "1.3.2",
"description": "Composable visualisation library for web with a data-first approach",
"homepage": "https://muzejs.org",
"license": "MIT",
Expand Down

0 comments on commit cb8726a

Please sign in to comment.