Browse Source

Clear the canvas offset on resize. Fixes #699

pull/803/head
Artur Arseniev 9 years ago
parent
commit
6a5b55a42c
  1. 3
      src/canvas/view/CanvasView.js
  2. 6
      test/specs/parser/model/ParserCss.js

3
src/canvas/view/CanvasView.js

@ -1,10 +1,11 @@
import { on, off } from 'utils/mixins';
const FrameView = require('./FrameView');
const $ = Backbone.$;
module.exports = Backbone.View.extend({
initialize(o) {
_.bindAll(this, 'renderBody', 'onFrameScroll', 'clearOff');
window.onscroll = this.clearOff;
on(window, 'scroll resize', this.clearOff);
this.config = o.config || {};
this.em = this.config.em || {};
this.ppfx = this.config.pStylePrefix || '';

6
test/specs/parser/model/ParserCss.js

@ -2,7 +2,7 @@ const ParserCss = require('parser/model/ParserCss');
module.exports = {
run() {
describe.only('ParserCss', () => {
describe('ParserCss', () => {
var obj;
beforeEach(() => {
@ -133,6 +133,7 @@ module.exports = {
var str =
'@media only screen and (max-width: 992px){ .test1.test2:hover{ color:red }}';
var result = {
atRuleType: 'media',
selectors: ['test1', 'test2'],
style: { color: 'red' },
state: 'hover',
@ -145,6 +146,7 @@ module.exports = {
it('Parse rule inside media query', () => {
var str = '@media (max-width: 992px){ .test1.test2:hover{ color:red }}';
var result = {
atRuleType: 'media',
selectors: ['test1', 'test2'],
style: { color: 'red' },
state: 'hover',
@ -167,11 +169,13 @@ module.exports = {
selectors: ['test1', 'test2'],
style: { color: 'red' },
state: 'hover',
atRuleType: 'media',
mediaText: '(max-width: 992px)'
},
{
selectors: ['test2'],
style: { color: 'blue' },
atRuleType: 'media',
mediaText: '(max-width: 992px)'
}
];

Loading…
Cancel
Save