Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Ember from 'ember';
- export default Ember.Component.extend({
- didInsertElement(){
- this._super(...arguments);
- const box = $('#box');
- this.set('_box', box);
- $('#handle').on('mousedown', (e) => {
- $(window).on('mousemove', this.startResizing.bind(this));
- $(window).on('mouseup', this.stopResizing.bind(this));
- });
- },
- willDestroyElement(){
- this._super(...arguments);
- this.stopResizing();
- },
- startResizing(e) {
- const box = this.get('_box')
- const offset = box.offset();
- box.width(e.clientX + offset.left);
- box.height(e.clientY + offset.top);
- },
- stopResizing() {
- $(window).off('mousemove');
- $(window).off('mouseup');
- }
- });
Add Comment
Please, Sign In to add comment