Adding transform method to Base node
This commit is contained in:
		
							parent
							
								
									340d6b4859
								
							
						
					
					
						commit
						f81ba6535f
					
				@ -10,6 +10,10 @@ export default {
 | 
			
		||||
    return this.container.getBBox();
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  transform(matrix) {
 | 
			
		||||
    return this.container.transform(matrix);
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  renderLabel(text) {
 | 
			
		||||
    var group = this.container.group()
 | 
			
		||||
      .addClass('label');
 | 
			
		||||
@ -86,10 +90,9 @@ export default {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    _.reduce(items, (offset, item) => {
 | 
			
		||||
      var element = item.container || item,
 | 
			
		||||
          box;
 | 
			
		||||
      var box;
 | 
			
		||||
 | 
			
		||||
      element.transform(Snap.matrix()
 | 
			
		||||
      item.transform(Snap.matrix()
 | 
			
		||||
        .translate(offset, 0));
 | 
			
		||||
 | 
			
		||||
      box = item.getBBox();
 | 
			
		||||
@ -100,10 +103,8 @@ export default {
 | 
			
		||||
    }, 0);
 | 
			
		||||
 | 
			
		||||
    _.each(items, item => {
 | 
			
		||||
      var element = item.container || item;
 | 
			
		||||
 | 
			
		||||
      element.transform(Snap.matrix()
 | 
			
		||||
        .add(element.transform().localMatrix)
 | 
			
		||||
      item.transform(Snap.matrix()
 | 
			
		||||
        .add(item.transform().localMatrix)
 | 
			
		||||
        .translate(0, verticalCenter - item.getBBox().cy));
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
@ -116,10 +117,9 @@ export default {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    _.reduce(items, (offset, item) => {
 | 
			
		||||
      var element = item.container || item,
 | 
			
		||||
          box;
 | 
			
		||||
      var box;
 | 
			
		||||
 | 
			
		||||
      element.transform(Snap.matrix()
 | 
			
		||||
      item.transform(Snap.matrix()
 | 
			
		||||
        .translate(0, offset));
 | 
			
		||||
 | 
			
		||||
      box = item.getBBox();
 | 
			
		||||
@ -130,10 +130,8 @@ export default {
 | 
			
		||||
    }, 0);
 | 
			
		||||
 | 
			
		||||
    _.each(items, item => {
 | 
			
		||||
      var element = item.container || item;
 | 
			
		||||
 | 
			
		||||
      element.transform(Snap.matrix()
 | 
			
		||||
        .add(element.transform().localMatrix)
 | 
			
		||||
      item.transform(Snap.matrix()
 | 
			
		||||
        .add(item.transform().localMatrix)
 | 
			
		||||
        .translate(horizontalCenter - item.getBBox().cx, 0));
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ export default _.extend({}, Base, {
 | 
			
		||||
    var box, paths = [];
 | 
			
		||||
 | 
			
		||||
    this._content.position();
 | 
			
		||||
    this._content.container.transform(this._repeat.contentPosition());
 | 
			
		||||
    this._content.transform(this._repeat.contentPosition());
 | 
			
		||||
 | 
			
		||||
    box = this._content.getBBox();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ export default _.extend({}, Base, {
 | 
			
		||||
 | 
			
		||||
  _render() {
 | 
			
		||||
    this.regexp.render(this.container.group());
 | 
			
		||||
    this.regexp.container.transform(Snap.matrix()
 | 
			
		||||
    this.regexp.transform(Snap.matrix()
 | 
			
		||||
      .translate(10, 0));
 | 
			
		||||
 | 
			
		||||
    this.start = this.container.circle()
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ export default _.extend({}, Base, {
 | 
			
		||||
  _position() {
 | 
			
		||||
    this.regexp.position();
 | 
			
		||||
 | 
			
		||||
    this.positionLabeledBox(this.regexp.container, {
 | 
			
		||||
    this.positionLabeledBox(this.regexp, {
 | 
			
		||||
      padding: 10
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user