Browse Source

Update highlighters

pull/36/head
Artur Arseniev 10 years ago
parent
commit
f1b02a329f
  1. 8
      src/canvas/main.js
  2. 5
      src/canvas/view/CanvasView.js
  3. 5
      src/commands/view/SelectComponent.js

8
src/canvas/main.js

@ -84,14 +84,6 @@ define(function(require) {
return this.CanvasView.hlEl;
},
/**
* Returns selector highlighter element
* @return {HTMLElement}
*/
getHighlighterSel: function(){
return this.CanvasView.hlSelEl;
},
/**
* Returns badge element
* @return {HTMLElement}

5
src/canvas/view/CanvasView.js

@ -12,13 +12,11 @@ function(Backbone, FrameView) {
this.frame = new FrameView({ model: this.model.get('frame')});
this.toolsEl = $('<div>', { id: this.ppfx + 'tools' }).get(0);
this.hlEl = $('<div>', { class: this.ppfx + 'highlighter' }).get(0);
this.hlSelEl = $('<div>', { class: this.ppfx + 'highlighter-sel' }).get(0);
this.badgeEl = $('<div>', {class: this.ppfx + 'badge'}).get(0);
this.placerEl = $('<div>', {class: this.ppfx + 'placeholder'}).get(0);
this.placerIntEl = $('<div>', {class: this.ppfx + 'placeholder-int'}).get(0);
this.placerEl.appendChild(this.placerIntEl);
this.toolsEl.appendChild(this.hlEl);
this.toolsEl.appendChild(this.hlSelEl);
this.toolsEl.appendChild(this.badgeEl);
this.toolsEl.appendChild(this.placerEl);
},
@ -35,7 +33,8 @@ function(Backbone, FrameView) {
var conf = this.config.em.get('Config');
body.append(wrap.render()).append(cssc.render());
var protCss = conf.protectedCss;
var frameCss = '.' + this.ppfx + 'dashed *{outline: 1px dashed rgba(170,170,170,0.7); outline-offset: -2px;}';
var frameCss = '.' + this.ppfx + 'dashed *{outline: 1px dashed rgba(170,170,170,0.7); outline-offset: -2px}' +
'.' + this.ppfx + 'comp-selected{outline: 3px solid #3b97e3 !important}';
if(protCss)
body.append('<style>' + frameCss + protCss + '</style>');
}

5
src/commands/view/SelectComponent.js

@ -161,10 +161,7 @@ define(function() {
if(nMd){
this.editorModel.set('selectedComponent', nMd);
nMd.set('status','selected');
if(!this.hlSel)
this.hlSel = $(this.canvas.getHighlighterSel());
var elP = this.getElementPos($el);
this.hlSel.css({left: elP.left, top: elP.topP, height: elP.height, width: elP.width });
}
},
@ -270,8 +267,6 @@ define(function() {
stop: function() {
if(!this.selEl)
this.selEl = $(this.getCanvasBody()).find('*');
if(this.hlSel)
this.hlSel.css({ left: -10000, top:-10000 });
this.frameOff = this.canvasOff = this.adjScroll = null;
$(this.frameEl.contentWindow).off('keydown');

Loading…
Cancel
Save