How to use the @mathigon/boost.registerElement function in @mathigon/boost

To help you get started, we’ve selected a few @mathigon/boost examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathigon / textbooks / content / shared / components / code-editor.js View on Github external
$editor2.show();
        cm1.refresh();
        cm2.refresh();
      } else if (state === 1) {
        $button.exit('pop');
        this.trigger('continue');
      }
      state += 1;
    });
  }
}

// -----------------------------------------------------------------------------

registerElement('x-code-editor', CodeEditor);
registerElement('x-code-checker', CodeChecker);
github mathigon / textbooks / content / shared / components / code-editor.js View on Github external
$button.text = 'Continue';
        $editor2.show();
        cm1.refresh();
        cm2.refresh();
      } else if (state === 1) {
        $button.exit('pop');
        this.trigger('continue');
      }
      state += 1;
    });
  }
}

// -----------------------------------------------------------------------------

registerElement('x-code-editor', CodeEditor);
registerElement('x-code-checker', CodeChecker);
github mathigon / textbooks / transformations-and-symmetry / components / wallpaper.js View on Github external
this.$('.save').on('click', e => e.target.href = $canvas.pngImage);

    slide($canvas, {
      start: p => drawPoint(context, activeGroup, p),
      move(p, _, last) {
        let l = new Line(last, p);
        let n = l.length/8;
        for (let i=0; i this.trigger('draw'),
      justInside: true
    });
  }
}

registerElement('x-wallpaper', Wallpaper, {templateId: '#wallpaper'});
github mathigon / textbooks / content / linear-functions / components / numberline.js View on Github external
const x = round(MIN + (px / width) * (MAX - MIN), 1);

      const y = round(F(x), 1);
      const py = (y - MIN) / (MAX - MIN) * width;

      $slider.text = x;
      $output.text = y;
      $output.css('left', py + 'px');
      $output.css('display', (y < MIN || y > MAX) ? 'none' : 'block');
      $connection.setAttr('d', `M ${px} 0 C ${px} 40, ${py} 20, ${py} 60`);
    }

  }
}

registerElement('x-numberline', Numberline, {templateId: '#numberline'});
github mathigon / textbooks / content / transformations / components / wallpaper.js View on Github external
this.$('.save').on('click', e => e.target.href = $canvas.pngImage);

    slide($canvas, {
      start: p => drawPoint(context, activeGroup, p),
      move(p, _, last) {
        let l = new Line(last, p);
        let n = l.length/8;
        for (let i=0; i this.trigger('draw'),
      justInside: true
    });
  }
}

registerElement('x-wallpaper', Wallpaper, {templateId: '#wallpaper'});