Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions sass/components/canvas/canvas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@

.chart-editor-canvas-view {
position: relative;
cursor: grab;

.canvas-view {
position: absolute;
Expand Down Expand Up @@ -241,8 +242,8 @@
}

.interaction-handler {
cursor: -webkit-grab;
cursor: grab;
// cursor: -webkit-grab;
// cursor: grab;
fill: none;
stroke: none;
pointer-events: fill;
Expand Down Expand Up @@ -590,10 +591,8 @@
}

.bounding-box {
cursor: default;

&.interactable {
cursor: pointer;
// cursor: pointer;
}

* {
Expand Down
6 changes: 5 additions & 1 deletion src/app/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,13 @@ export function renderGraphicalElementSVG(
onWheel?: (e: React.MouseEvent<Element>) => void;
onMouseMove?: (e: React.MouseEvent<Element>) => void;
} = {};
if (style) {
style.cursor = element.style?.cursor ?? "default";
}
if (element.selectable) {
style.cursor = "pointer";
// style.cursor = "pointer";
style.pointerEvents = "all";

if (options.onClick) {
mouseEvents.onClick = (e: React.MouseEvent<Element>) => {
e.stopPropagation();
Expand Down
1 change: 1 addition & 0 deletions src/app/stores/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export function createDefaultChart(
backgroundOpacity: 1,
enableContextMenu: true,
exposed: true,
cursor: "default"
},
mappings: {
marginTop: {
Expand Down
2 changes: 2 additions & 0 deletions src/core/graphics/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface Style {
strokeLinejoin?: "round" | "miter" | "bevel";
strokeLinecap?: "round" | "butt" | "square";

cursor?: string;

colorFilter?: ColorFilter;

fillColor?: Color;
Expand Down
4 changes: 4 additions & 0 deletions src/core/graphics/renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class ChartRenderer {
enableContextMenu: <boolean>cls.object.properties.enableContextMenu,
enableSelection: <boolean>cls.object.properties.enableSelection,
};
if (!markGraphics.style) {
markGraphics.style = {};
}
markGraphics.style.cursor = <string>cls.object.properties.cursor
const group = makeGroup([markGraphics]);
group.key = `gl:${glyph._id}-mkst-gr:${markIndex}-${markGraphics.key}`;
return group;
Expand Down
1 change: 1 addition & 0 deletions src/core/prototypes/charts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class RectangleChart extends ChartClass {
backgroundColor: null,
backgroundOpacity: 1,
enableContextMenu: true,
cursor: "default"
};

public readonly object: Specification.Chart & {
Expand Down
19 changes: 19 additions & 0 deletions src/core/prototypes/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export abstract class ObjectClass<
enableContextMenu: true,
enableSelection: true,
exposed: true,
cursor: "default"
};

/** Default mapping values */
Expand Down Expand Up @@ -122,6 +123,24 @@ export abstract class ObjectClass<
searchSection: strings.objects.interactivity,
}
),
manager.inputSelect(
{ property: "cursor" },
{
type: "dropdown",
label: strings.objects.cursor.cursor,
searchSection: strings.objects.interactivity,
options: [
"default",
"crosshair",
"grab"
],
labels: [
strings.objects.cursor.default,
strings.objects.cursor.crosshair,
strings.objects.cursor.grab
]
}
),
]
),
];
Expand Down
6 changes: 6 additions & 0 deletions src/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,12 @@ export const strings = {
dropTickData: "Tick data: drop here to assign tick data",
toolTips: "Tooltips",
selection: "Selection",
cursor: {
cursor: "Cursor",
default: "Default",
crosshair: "Crosshair",
grab: "Grab",
},
axes: {
data: "Data",
numericalSuffix: ": Numerical",
Expand Down
Loading