projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
First version of complete Chakart rules (unfinished). Draft diagramer (missing marks...
[xogo.git]
/
base_rules.js
diff --git
a/base_rules.js
b/base_rules.js
index
ea34a3d
..
ad30c0a
100644
(file)
--- a/
base_rules.js
+++ b/
base_rules.js
@@
-415,6
+415,7
@@
export default class ChessRules {
// Graphical (can use variables defined above)
this.containerId = o.element;
// Graphical (can use variables defined above)
this.containerId = o.element;
+ this.isDiagram = o.diagram;
this.graphicalInit();
}
this.graphicalInit();
}
@@
-561,7
+562,8
@@
export default class ChessRules {
window.onresize = () => this.re_drawBoardElements();
const g_init = () => {
this.re_drawBoardElements();
window.onresize = () => this.re_drawBoardElements();
const g_init = () => {
this.re_drawBoardElements();
- this.initMouseEvents();
+ if (!this.isDiagram)
+ this.initMouseEvents();
};
let container = document.getElementById(this.containerId);
if (container.getBoundingClientRect().width == 0) {
};
let container = document.getElementById(this.containerId);
if (container.getBoundingClientRect().width == 0) {
@@
-655,6
+657,7
@@
export default class ChessRules {
}
setupPieces(r) {
}
setupPieces(r) {
+ // TODO: d_pieces : only markers (for diagrams) / also in rescale()
if (this.g_pieces) {
// Refreshing: delete old pieces first
for (let i=0; i<this.size.x; i++) {
if (this.g_pieces) {
// Refreshing: delete old pieces first
for (let i=0; i<this.size.x; i++) {
@@
-1007,6
+1010,8
@@
export default class ChessRules {
}
removeListeners() {
}
removeListeners() {
+ if (this.isDiagram)
+ return; //no listeners in this case
if ('onmousedown' in window) {
this.mouseListeners.forEach(ml => {
document.removeEventListener(ml.type, ml.listener);
if ('onmousedown' in window) {
this.mouseListeners.forEach(ml => {
document.removeEventListener(ml.type, ml.listener);