@@ -593,7 +595,10 @@ export class MainView extends React.Component {
+
+
+
+
{this.mainContent}
@@ -606,7 +611,7 @@ export class MainView extends React.Component {
-
+
{this.snapLines}
diff --git a/src/client/views/collections/collectionFreeForm/InkOptionsMenu.scss b/src/client/views/collections/collectionFreeForm/InkOptionsMenu.scss
index a9fab4c1e..7329f4fc1 100644
--- a/src/client/views/collections/collectionFreeForm/InkOptionsMenu.scss
+++ b/src/client/views/collections/collectionFreeForm/InkOptionsMenu.scss
@@ -26,6 +26,11 @@
/* Make the buttons appear below each other */
}
+.btn-draw {
+ display: inline;
+ /* Make the buttons appear below each other */
+}
+
.btn2-group {
display: block;
background: #323232;
diff --git a/src/client/views/collections/collectionFreeForm/InkOptionsMenu.tsx b/src/client/views/collections/collectionFreeForm/InkOptionsMenu.tsx
index f1032adaa..7de70b8cd 100644
--- a/src/client/views/collections/collectionFreeForm/InkOptionsMenu.tsx
+++ b/src/client/views/collections/collectionFreeForm/InkOptionsMenu.tsx
@@ -17,6 +17,7 @@ import { DocumentType } from "../../../documents/DocumentTypes";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { IconProp, library } from '@fortawesome/fontawesome-svg-core';
import { faBold, faItalic, faChevronLeft, faUnderline, faStrikethrough, faSubscript, faSuperscript, faIndent, faEyeDropper, faCaretDown, faPalette, faArrowsAlt, faHighlighter, faLink, faPaintRoller, faSleigh, faBars, faFillDrip, faBrush, faPenNib, faShapes, faArrowLeft, faEllipsisH, faBezierCurve, } from "@fortawesome/free-solid-svg-icons";
+import { Cast, StrCast, BoolCast } from "../../../../fields/Types";
library.add(faBold, faItalic, faChevronLeft, faUnderline, faStrikethrough, faSuperscript, faSubscript, faIndent, faEyeDropper, faCaretDown, faPalette, faArrowsAlt, faHighlighter, faLink, faPaintRoller, faBars, faFillDrip, faBrush, faPenNib, faShapes, faArrowLeft, faEllipsisH, faBezierCurve);
@@ -28,36 +29,67 @@ export default class InkOptionsMenu extends AntimodeMenu {
private _width = ["1", "5", "10", "100"];
// private _buttons = ["circle", "triangle", "rectangle", "arrow", "line"];
// private _icons = ["O", "∆", "ロ", "➜", "-"];
- private _buttons = ["circle", "triangle", "rectangle", "line", "noRec", "",];
- private _icons = ["O", "∆", "ロ", "⎯", "✖︎", " "];
+ // private _buttons = ["circle", "triangle", "rectangle", "line", "noRec", "",];
+ // private _icons = ["O", "∆", "ロ", "⎯⎯⎯", "✖︎", " "];
//arrowStart and arrowEnd must match and defs must exist in Inking Stroke
- private _arrowStart = ["arrowHead", "arrowHead", "dot", "dot", "none"];
- private _arrowEnd = ["none", "arrowEnd", "none", "dot", "none"];
- private _arrowIcons = ["→", "↔︎", "•", "••", " "];
+ // private _arrowStart = ["arrowHead", "arrowHead", "dot", "dot", "none"];
+ // private _arrowEnd = ["none", "arrowEnd", "none", "dot", "none"];
+ // private _arrowIcons = ["→", "↔︎", "•", "••", " "];
+ private _draw = ["⎯", "→", "↔︎", "∿", "↝", "↭", "ロ", "O", "∆"];
+ private _head = ["none", "arrowHead", "arrowHead", "none", "arrowHead", "arrowHead", "none", "none", "none"];
+ private _end = ["none", "none", "arrowEnd", "none", "none", "arrowEnd", "none", "none", "none"];
+ private _shape = ["", "", "", "", "", "", "rectangle", "circle", "triangle"];
+
+ @observable _shapesNum = this._shape.length;
+ @observable _selected = this._shapesNum;
+
+ @observable private collapsed: boolean = false;
@observable _colorBtn = false;
@observable _widthBtn = false;
@observable _fillBtn = false;
- @observable _arrowBtn = false;
- @observable _dashBtn = false;
- @observable _shapeBtn = false;
+ // @observable _arrowBtn = false;
+ // @observable _dashBtn = false;
+ // @observable _shapeBtn = false;
constructor(props: Readonly<{}>) {
super(props);
InkOptionsMenu.Instance = this;
this._canFade = false; // don't let the inking menu fade away
+ this.Pinned = BoolCast(Doc.UserDoc()["inkOptionsMenu-pinned"]);
+
}
- getColors = () => {
- return this._palette;
+ @action
+ toggleMenuPin = (e: React.MouseEvent) => {
+ Doc.UserDoc()["inkOptionsMenu-pinned"] = this.Pinned = !this.Pinned;
+ if (!this.Pinned) {
+ // this.fadeOut(true);
+ }
}
@action
- changeArrow = (arrowStart: string, arrowEnd: string) => {
- SetActiveArrowStart(arrowStart);
- SetActiveArrowEnd(arrowEnd);
+ protected toggleCollapse = (e: React.MouseEvent) => {
+ this.collapsed = !this.collapsed;
+ setTimeout(() => {
+ const x = Math.min(this._left, window.innerWidth - InkOptionsMenu.Instance.width);
+ InkOptionsMenu.Instance.jumpTo(x, this._top, true);
+ }, 0);
+ }
+
+
+
+
+ getColors = () => {
+ return this._palette;
}
+ // @action
+ // changeArrow = (arrowStart: string, arrowEnd: string) => {
+ // SetActiveArrowStart(arrowStart);
+ // SetActiveArrowEnd(arrowEnd);
+ // }
+
@action
changeColor = (color: string, type: string) => {
const col: ColorState = {
@@ -116,40 +148,77 @@ export default class InkOptionsMenu extends AntimodeMenu {
this.editProperties(ActiveDash(), "dash");
}
- @computed get arrowPicker() {
- var currIcon;
- for (var i = 0; i < this._arrowStart.length; i++) {
- if (this._arrowStart[i] === ActiveArrowStart() && this._arrowEnd[i] === ActiveArrowEnd()) {
- currIcon = this._arrowIcons[i];
- if (this._arrowIcons[i] === " ") {
- currIcon = "➤";
- }
- }
- }
- var arrowPicker = ;
- if (this._arrowBtn) {
- arrowPicker =
- {arrowPicker}
- {this._arrowStart.map((arrowStart, i) => {
- return ;
- })}
-
;
- }
- return arrowPicker;
+ @computed get drawButtons() {
+ const drawButtons =
+ {this._draw.map((icon, i) => {
+ return ;
+ })}
;
+ return drawButtons;
}
+ // @computed get arrowPicker() {
+ // var currIcon;
+ // for (var i = 0; i < this._arrowStart.length; i++) {
+ // if (this._arrowStart[i] === ActiveArrowStart() && this._arrowEnd[i] === ActiveArrowEnd()) {
+ // currIcon = this._arrowIcons[i];
+ // if (this._arrowIcons[i] === " ") {
+ // currIcon = "➤";
+ // }
+ // }
+ // }
+ // var arrowPicker = ;
+ // if (this._arrowBtn) {
+ // arrowPicker =
+ // {arrowPicker}
+ // {this._arrowStart.map((arrowStart, i) => {
+ // return ;
+ // })}
+ //
;
+ // }
+ // return arrowPicker;
+ // }
+
@computed get widthPicker() {
var widthPicker = ;
- } else {
- for (var i = 0; i < this._icons.length; i++) {
- if (GestureOverlay.Instance.InkShape === this._buttons[i]) {
- currIcon = this._icons[i];
- }
- }
- }
- var shapePicker = ;
- if (this._shapeBtn) {
- shapePicker =
- {shapePicker}
- {this._buttons.map((btn, i) => {
- var ttl = btn;
- if (btn === "") {
- ttl = "no shape";
- }
- if (btn === "noRec") {
- ttl = "disable shape recognition";
- }
- return ;
- })}
-
;
- }
- return shapePicker;
- }
+ // @computed get shapePicker() {
+ // var currIcon;
+ // if (GestureOverlay.Instance.InkShape === "") {
+ // currIcon = ;
+ // } else {
+ // for (var i = 0; i < this._icons.length; i++) {
+ // if (GestureOverlay.Instance.InkShape === this._buttons[i]) {
+ // currIcon = this._icons[i];
+ // }
+ // }
+ // }
+ // var shapePicker = ;
+ // if (this._shapeBtn) {
+ // shapePicker =
+ // {shapePicker}
+ // {this._buttons.map((btn, i) => {
+ // var ttl = btn;
+ // if (btn === "") {
+ // ttl = "no shape";
+ // }
+ // if (btn === "noRec") {
+ // ttl = "disable shape recognition";
+ // }
+ // return ;
+ // })}
+ //
;
+ // }
+ // return shapePicker;
+ // }
@computed get bezierButton() {
return ,
- this.shapePicker,
- this.bezierButton,
+ // this.shapePicker,
+ // this.bezierButton,
this.widthPicker,
this.colorPicker,
this.fillPicker,
- this.arrowPicker,
- this.dashButton,
+ this.drawButtons,
+ // this.arrowPicker,
+ // this.dashButton,
+
+
];
+
+ // return this.getElement(buttons);
return this.getElement(buttons);
}
}
Scripting.addGlobal(function activatePen(penBtn: any) {
if (penBtn) {
- Doc.SetSelectedTool(InkTool.Pen);
+ //no longer changes to inkmode
+ // Doc.SetSelectedTool(InkTool.Pen);
InkOptionsMenu.Instance.jumpTo(300, 300);
+ InkOptionsMenu.Instance.Pinned = true;
+
} else {
- Doc.SetSelectedTool(InkTool.None);
+ // Doc.SetSelectedTool(InkTool.None);
+ InkOptionsMenu.Instance.Pinned = false;
InkOptionsMenu.Instance.fadeOut(true);
+
}
});
\ No newline at end of file
--
cgit v1.2.3-70-g09d2