@genome-spy/core 0.56.0 → 0.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/index.es.js +310 -314
- package/dist/bundle/index.js +22 -22
- package/dist/src/selection/selection.d.ts +6 -6
- package/dist/src/selection/selection.d.ts.map +1 -1
- package/dist/src/selection/selection.js +21 -16
- package/dist/src/spec/parameter.d.ts +3 -0
- package/dist/src/view/paramMediator.js +3 -3
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +48 -48
- package/package.json +2 -2
|
@@ -51,13 +51,13 @@ export function isMultiPointSelection(selection: import("../types/selectionTypes
|
|
|
51
51
|
*/
|
|
52
52
|
export function isProjectedSelection(selection: import("../types/selectionTypes.js").Selection): selection is import("../types/selectionTypes.js").ProjectedSelection;
|
|
53
53
|
/**
|
|
54
|
-
* @param {
|
|
55
|
-
* @returns {
|
|
54
|
+
* @param {import("../spec/parameter.js").SelectionTypeOrConfig} typeOrConfig
|
|
55
|
+
* @returns {import("../spec/parameter.js").SelectionConfig}
|
|
56
56
|
*/
|
|
57
|
-
export function
|
|
57
|
+
export function asSelectionConfig(typeOrConfig: import("../spec/parameter.js").SelectionTypeOrConfig): import("../spec/parameter.js").SelectionConfig;
|
|
58
58
|
/**
|
|
59
|
-
* @param {
|
|
60
|
-
* @returns {
|
|
59
|
+
* @param {import("../spec/parameter.js").SelectionConfig} config
|
|
60
|
+
* @returns {config is import("../spec/parameter.js").PointSelectionConfig}
|
|
61
61
|
*/
|
|
62
|
-
export function
|
|
62
|
+
export function isPointSelectionConfig(config: import("../spec/parameter.js").SelectionConfig): config is import("../spec/parameter.js").PointSelectionConfig;
|
|
63
63
|
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/selection/selection.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kDAHW,OAAO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AAE,SAAS,OAAO,qBAAqB,EAAE,KAAK,CAAC,CAAC,CAAC,GACzF,OAAO,4BAA4B,EAAE,mBAAmB,CA2BpE;AAED;;;;GAIG;AACH,yCAJW,OAAO,4BAA4B,EAAE,SAAS,SAC9C,OAAO,qBAAqB,EAAE,KAAK,UACnC,OAAO,WAkBjB;AAED;;GAEG;AACH,oDAFW;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAC,UAM1C;AAED;;;GAGG;AACH,4CAHW,OAAO,4BAA4B,EAAE,SAAS,oEAKxD;AAED;;;GAGG;AACH,kDAHW,OAAO,4BAA4B,EAAE,SAAS,0EAKxD;AAED;;;GAGG;AACH,iDAHW,OAAO,4BAA4B,EAAE,SAAS,yEAKxD;AAED;;;GAGG;AACH,gDAHW,OAAO,4BAA4B,EAAE,SAAS,wEAKxD;AAED;;;GAGG;AACH,gDAHW,OAAO,sBAAsB,EAAE,qBAAqB,GAClD,OAAO,sBAAsB,EAAE,eAAe,CAiB1D;AAED;;;GAGG;AACH,+CAHW,OAAO,sBAAsB,EAAE,eAAe,iEAKxD"}
|
|
@@ -125,25 +125,30 @@ export function isProjectedSelection(selection) {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* @param {
|
|
129
|
-
* @returns {
|
|
128
|
+
* @param {import("../spec/parameter.js").SelectionTypeOrConfig} typeOrConfig
|
|
129
|
+
* @returns {import("../spec/parameter.js").SelectionConfig}
|
|
130
130
|
*/
|
|
131
|
-
export function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
export function asSelectionConfig(typeOrConfig) {
|
|
132
|
+
const config =
|
|
133
|
+
typeof typeOrConfig === "string"
|
|
134
|
+
? { type: typeOrConfig }
|
|
135
|
+
: typeOrConfig;
|
|
136
|
+
|
|
137
|
+
// Set some default
|
|
138
|
+
if (isPointSelectionConfig(config)) {
|
|
139
|
+
config.on ??= "click";
|
|
140
|
+
if (config.on === "click") {
|
|
141
|
+
config.toggle = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return config;
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
/**
|
|
141
|
-
* @param {
|
|
142
|
-
* @returns {
|
|
149
|
+
* @param {import("../spec/parameter.js").SelectionConfig} config
|
|
150
|
+
* @returns {config is import("../spec/parameter.js").PointSelectionConfig}
|
|
143
151
|
*/
|
|
144
|
-
export function
|
|
145
|
-
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return config.toggle ?? config.on === "click";
|
|
152
|
+
export function isPointSelectionConfig(config) {
|
|
153
|
+
return config && config.type == "point";
|
|
149
154
|
}
|
|
@@ -253,4 +253,7 @@ export interface SelectionParameter<T extends SelectionType = SelectionType>
|
|
|
253
253
|
*/
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
export type SelectionConfig = PointSelectionConfig | IntervalSelectionConfig;
|
|
257
|
+
export type SelectionTypeOrConfig = SelectionType | SelectionConfig;
|
|
258
|
+
|
|
256
259
|
export type Parameter = VariableParameter | SelectionParameter;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isString } from "vega-util";
|
|
2
2
|
import createFunction from "../utils/expression.js";
|
|
3
3
|
import {
|
|
4
|
+
asSelectionConfig,
|
|
4
5
|
createMultiPointSelection,
|
|
5
6
|
createSinglePointSelection,
|
|
6
7
|
isPointSelectionConfig,
|
|
7
|
-
isTogglingEnabledInPointSelectionConfig,
|
|
8
8
|
} from "../selection/selection.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -105,11 +105,11 @@ export default class ParamMediator {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if ("select" in param) {
|
|
108
|
-
const select = param.select;
|
|
108
|
+
const select = asSelectionConfig(param.select);
|
|
109
109
|
if (isPointSelectionConfig(select)) {
|
|
110
110
|
// Set initial value so that production rules in shaders can be generated, etc.
|
|
111
111
|
setter(
|
|
112
|
-
|
|
112
|
+
select.toggle
|
|
113
113
|
? createMultiPointSelection()
|
|
114
114
|
: createSinglePointSelection(null)
|
|
115
115
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unitView.d.ts","sourceRoot":"","sources":["../../../src/view/unitView.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unitView.d.ts","sourceRoot":"","sources":["../../../src/view/unitView.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,wBAHU,OAAO,OAAO,iBAAiB,EAAE,QAAQ,EAAE,cAAc,kBAAkB,EAAE,OAAO,CAAC,CAc7F;AAEF;IAeI;;;;;;;;OAQG;IACH,kBAPW,OAAO,iBAAiB,EAAE,QAAQ,WAClC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAiCzC;IA5BG,yCAAgB;IAIZ,iDAAiD;IACjD,MADW,OAAO,kBAAkB,EAAE,OAAO,CACnB;IAqHlC,2DAIC;IAED;;;;;OAKG;IAEH,iEA+FC;IAED;;;;;OAKG;IACH,4IAEC;IAkBD;;OAEG;IACH,uDAEC;IAED;;;;;;;;;;;;;OAaG;IACH,uEAHW,OAAO,oBAAoB,EAAE,IAAI,iDAqB3C;IAED,uBAQC;IAgBD;;;;OAIG;IACH,8BAJW,MAAM,+DAEJ,OAAO,iBAAiB,EAAE,kBAAkB,CAKxD;;CACJ;iBAnYgB,WAAW"}
|
|
@@ -17,13 +17,12 @@ import createDomain from "../utils/domainArray.js";
|
|
|
17
17
|
import AxisResolution from "./axisResolution.js";
|
|
18
18
|
import View from "./view.js";
|
|
19
19
|
import {
|
|
20
|
+
asSelectionConfig,
|
|
20
21
|
createMultiPointSelection,
|
|
21
22
|
createSinglePointSelection,
|
|
22
23
|
isPointSelectionConfig,
|
|
23
|
-
isTogglingEnabledInPointSelectionConfig,
|
|
24
24
|
updateMultiPointSelection,
|
|
25
25
|
} from "../selection/selection.js";
|
|
26
|
-
import { isString } from "vega-util";
|
|
27
26
|
import { UNIQUE_ID_KEY } from "../data/transforms/identifier.js";
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -107,11 +106,12 @@ export default class UnitView extends View {
|
|
|
107
106
|
continue;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
const select = param.select;
|
|
109
|
+
const select = asSelectionConfig(param.select);
|
|
110
|
+
|
|
111
111
|
if (isPointSelectionConfig(select)) {
|
|
112
112
|
// Handle projection-free point selections
|
|
113
113
|
|
|
114
|
-
const none =
|
|
114
|
+
const none = 0;
|
|
115
115
|
let lastId = none;
|
|
116
116
|
|
|
117
117
|
const setter = this.paramMediator.getSetter(name);
|
|
@@ -121,55 +121,55 @@ export default class UnitView extends View {
|
|
|
121
121
|
return h?.mark?.unitView === this ? h.datum : null;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
updateMultiPointSelection(
|
|
150
|
-
previousSelection,
|
|
151
|
-
{
|
|
152
|
-
toggle: [datum],
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
setter(
|
|
159
|
-
createMultiPointSelection(
|
|
160
|
-
datum ? [datum] : null
|
|
161
|
-
)
|
|
124
|
+
const listener = (
|
|
125
|
+
/** @type {any} */ _,
|
|
126
|
+
/** @type {import("../utils/interactionEvent.js").default} */ event
|
|
127
|
+
) => {
|
|
128
|
+
const mouseEvent = /** @type {MouseEvent} */ (
|
|
129
|
+
event.uiEvent
|
|
130
|
+
);
|
|
131
|
+
const datum = getHoveredDatum();
|
|
132
|
+
const id = datum ? datum[UNIQUE_ID_KEY] : none;
|
|
133
|
+
|
|
134
|
+
/** @type {any} */
|
|
135
|
+
let selection;
|
|
136
|
+
|
|
137
|
+
if (select.toggle) {
|
|
138
|
+
const toggle = mouseEvent.shiftKey;
|
|
139
|
+
|
|
140
|
+
if (toggle) {
|
|
141
|
+
if (datum) {
|
|
142
|
+
const previousSelection =
|
|
143
|
+
this.paramMediator.getValue(name);
|
|
144
|
+
selection = updateMultiPointSelection(
|
|
145
|
+
previousSelection,
|
|
146
|
+
{
|
|
147
|
+
toggle: [datum],
|
|
148
|
+
}
|
|
162
149
|
);
|
|
163
150
|
}
|
|
164
151
|
} else {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
createSinglePointSelection(datum);
|
|
169
|
-
setter(selection);
|
|
170
|
-
}
|
|
152
|
+
selection = createMultiPointSelection(
|
|
153
|
+
datum ? [datum] : null
|
|
154
|
+
);
|
|
171
155
|
}
|
|
156
|
+
} else {
|
|
157
|
+
if (id != lastId) {
|
|
158
|
+
lastId = id;
|
|
159
|
+
selection = createSinglePointSelection(datum);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (selection !== undefined) {
|
|
164
|
+
setter(selection);
|
|
172
165
|
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
this.addInteractionEventListener(
|
|
169
|
+
["mouseover", "pointerover"].includes(select.on)
|
|
170
|
+
? "mousemove"
|
|
171
|
+
: "click",
|
|
172
|
+
listener
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"contributors": [],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.56.
|
|
10
|
+
"version": "0.56.1",
|
|
11
11
|
"jsdelivr": "dist/bundle/index.js",
|
|
12
12
|
"unpkg": "dist/bundle/index.js",
|
|
13
13
|
"browser": "dist/bundle/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/long": "^4.0.1"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "453d25739c7996fc60fe5fa125784c8532b40e4f"
|
|
71
71
|
}
|